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

Related topics

Professor Jayesh video tutorial

Please use contact page in this website if you find anything incorrect or you want to share more information about the topic discussed above.