maximum element in sql
Who is the person getting 1st max salary
SELECT first-name
FROM employees
WHERE salary = (SELECT MAX(salary) FROM employees);
2nd max salary=
SELECT first-name , salary
FROM employees
WHERE salary = (SELECT MAX(salary) FROM employees WHERE salary NOT IN
(SELECT MAX(salary) FROM employees));
3rd max salary=
SELECT * FROM employees
WHERE salary = (SELECT * FROM (SELECT DISTINCT salary FROM employees
ORDER BY salary DESC) WHERE ROW NUM <=3
MINUS
SELECT * FROM (SELECT DISTINCT salary FROM employees
ORDER BY salary DESC) WHERE ROW NUM <=2);