Write a SQL statement using the HAVING SQL keyword. It can be anything, but it must work and it must make sense. Include a description of what the SQL is intended to do.
Solution
position of having clause
creating table
create table emp(empno number,ename varchar2(20),sal number,deptno number,mgrno number);
inserting data
insert into emp values(1000,\'amir\',25000,20,7566);
insert into emp values(1001,\'ajay\',26000,10,7466);
insert into emp values(1002,\'ananad\',21000,10,3566);
insert into emp values(1003,\'eswar\',29000,10,1566);
insert into emp values(1004,\'tina\',15000,30,3567);
insert into emp values(1005,\'yona\',12000,20,2566);
Usage of having Clause
Display deptno\'s whose employee count is greater than 1
select deptno,count(empno) from emp group by deptno having count(empno)>1;
above query displays the details of deptno and whose deptno\'s employee count is greater than 1
.