We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8c579e7 commit 65c4a71Copy full SHA for 65c4a71
SQL Deep Dive/Grouping Sets/solutions.sql
@@ -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