How to find the employee whose salary is second highest?
For example, in above table, “Hardik” has the second highest salary as 55000.
Below is simple query to find the employee whose salary is highest.
SELECT name, MAX(salary) as salary FROM employee;
We can use above query to find the second largest salary by nesting it.
SELECT name, MAX(salary) AS salary FROM employee WHERE salary < (SELECT MAX(salary) FROM employee);