O slideshow foi denunciado.
Seu SlideShare está sendo baixado. ×

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

Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Próximos SlideShares
Clauses
Clauses
Carregando em…3
×

Confira estes a seguir

1 de 2 Anúncio

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

Baixar para ler offline

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
.

Anúncio
Anúncio

Mais Conteúdo rRelacionado

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

Mais de lez31palka (20)

Anúncio

Mais recentes (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

×