•11:35 PM
Query 1
SELECT MAX(salary) FROM employee
WHERE salary NOT IN
( SELECT MAX(salary) FROM employee)
Query 2
SELECT MAX(salary) FROM employee
WHERE salary <
( SELECT MAX(salary) FROM employee)
Query 3 (for SQL Server)
SELECT MIN (salary) FROM employee
WHERE salary in
(SELECT TOP 2 (salary) FROM employee
ORDER BY salary DESC)
SELECT MAX(salary) FROM employee
WHERE salary NOT IN
( SELECT MAX(salary) FROM employee)
Query 2
SELECT MAX(salary) FROM employee
WHERE salary <
( SELECT MAX(salary) FROM employee)
Query 3 (for SQL Server)
SELECT MIN (salary) FROM employee
WHERE salary in
(SELECT TOP 2 (salary) FROM employee
ORDER BY salary DESC)