Docsity

Database Lab Solution 3, Lab Reports of Database Management Systems (DBMS)

Partial preview of the text

Download Database Lab Solution 3 and more Lab Reports Database Management Systems (DBMS) in PDF only on Docsity!

LAB 9

Q.No.

CODE:

select * from EMP where SAL = (select max(SAL) from EMP)

Q.No.

CODE:

select e.EMPNO,e.ENAME from EMP e where e.deptno = (select deptno from DEPT where DNAME = 'SALES') SCREENSHOT:

Q.No.

CODE:

select e.EMPNO,e.ENAME

SCREENSHOT:

Q.No.

CODE:

select EMPNO,ENAME,SAL from EMP where sal > ALL ( select sal from EMP where DEPTNO= 30 )

Q.No.

CODE:

select EMPNO,ENAME, SAL from EMP where sal > ( select MIN(sal) from EMP where DEPTNO= 30 ) SCREENSHOT:

Q.No.

CODE:

select DNAME, DEPTNO from DEPT where DEPTNO NOT IN ( select DEPTNO from EMP)

Q.No.

CODE:

SELECT ENAME, DEPTNO, SAL

FROM EMP e WHERE SAL > (select avg(SAL) from EMP e1 where e1.DEPTNO = e.DEPTNO);

Q.No.

CODE:

SELECT name,region,population,area from bbc where area = (select min(area) from bbc) SCREENSHOT:

Q.No.

CODE:

SELECT name,gdp from bbc where gdp > ANY (select gdp from bbc where region='Europe') and gdp =ANY(select gdp from bbc where region <> 'Europe')