+ 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?
1 Answer
+ 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;