Diese Präsentation wurde erfolgreich gemeldet.
Die SlideShare-Präsentation wird heruntergeladen. ×

Write a SQL statement using the HAVING SQL keyword- It can be anything.docx

Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Nächste SlideShare
Clauses
Clauses
Wird geladen in …3
×

Hier ansehen

1 von 2 Anzeige

Write a SQL statement using the HAVING SQL keyword- It can be anything.docx

Herunterladen, um offline zu lesen

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
.

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
.

Anzeige
Anzeige

Weitere Verwandte Inhalte

Ähnlich wie Write a SQL statement using the HAVING SQL keyword- It can be anything.docx (20)

Weitere von lez31palka (20)

Anzeige

Aktuellste (20)

Write a SQL statement using the HAVING SQL keyword- It can be anything.docx

  1. 1. 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

×