Skip to content

Commit 65c4a71

Browse files
authored
Create solutions.sql
1 parent 8c579e7 commit 65c4a71

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Calculate the total amount of employees per department using grouping sets
3+
* Database: Employees
4+
* Table: Employees
5+
*/
6+
7+
select grouping(e.dept_no), e.dept_no, COUNT(e.emp_no)
8+
FROM public.dept_emp as e
9+
GROUP BY
10+
GROUPING SETS (
11+
(e.dept_no),
12+
()
13+
)
14+
order by e.dept_no

0 commit comments

Comments
 (0)