Search your topic here

EMP (ENO, ENAME, AGE, BASIC)

Q. Consider the relations-
EMP (ENO, ENAME, AGE, BASIC)
WORK_ON (ENO, DNO)
DEPT (DNO, DNAME, CITY)
Express the following queries in SQL-
(i) Find names of employees whose basic pay is greater than average basic pay.
(ii) Find the sum of the basic pay of all the employees, the maximum basic pay, the minimum basic pay and the average basic pay.

Solution:
(i) select ENAME from EMP where BASIC > (select avg(BASIC) from EMP)

(ii) select sum(BASIC), max(BASIC), min(BASIC), avg(BASIC) from EMP

LEAVE A REPLY