Question: Can you pls elaborate on these. 1.regular subquery: SELECT MAX(SALARY) FROM EMPLOYEE WHERE SALARY NOT IN (SELECT MAX(SALARY) FROM EMPLOYEE); the above query returns the
Can you pls elaborate on these.
1.regular subquery:
SELECT MAX(SALARY)
FROM EMPLOYEE
WHERE SALARY NOT IN (SELECT MAX(SALARY) FROM EMPLOYEE);
the above query returns thesecond maxsalary in EMPLOYEE table.
2.correlated subquery:
SELECT ID,NAME
FROM EMPLOYEE E
WHERE SALARY > (SELECT AVG(SALARY) FROM EMPLOYEE WHERE DNO=E.DNO);
the above query returns the ID,NAME of an employee whose salary is greater than average salary of their department.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
