+ 1

Query for get count of department greater than 3

emp table having eid,ename,deptno,deptname. having 10 rows. For first 3 rows having deptno as 1,next 3 rows having deptno as 2,next 4 rows having deptno as 3...how get the count of deptno greater than 3?

4th Jul 2018, 3:50 AM
vijay
1 Odpowiedź
+ 2
SELECT count(deptno) FROM emp WHERE deptno >3 ; if it won't work then try this CREATE VIEW grpbydept as (SELECT * FROM emp GROUP BY deptno); SELECT count(deptno) FROM grpbydept WHERE deptno > 3;
4th Jul 2018, 4:07 AM
Nikhil Dhama
Nikhil Dhama - avatar