medium10 pts · first answer countswindow-functionssql
DISTINCT and a window count
An employees table has 3 departments with 50 rows. How many rows does this return?
SELECT DISTINCT dept, COUNT(*) OVER (PARTITION BY dept) AS headcount FROM employees;
Discussion 0
Join free to post in the discussion.