We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent adc45cf commit e2e4a1cCopy full SHA for e2e4a1c
12. Having.sql
@@ -1,4 +1,16 @@
1
-- GROUP BY HAVING
2
-- it will return all the dept. that has entry more than 2.
3
4
-select Department, count(Department) from Employee group by Department having count(Department) > 2;
+select Department, count(Department) from Employee group by Department having count(Department) > 2;
5
+
6
7
+-- difference b/w WHERE & HAVING.
8
9
+-- 1. WHERE clause is used to filter the rows from table based on specific condition
10
+-- HAVING clause is used to filter the rows from group based on specific condition
11
12
+-- 2. WHERE is used before GROUPBY clause
13
+-- HAVING is used after GROUPBY clause.
14
15
+-- 3. WHERE may or may not come with group by
16
+-- HAVING must come with group by only.
0 commit comments