Finding the Second Highest Salary 🏆
SELECT MAX(salary) AS second_highest_salary FROM employees WHERE salary < (SELECT MAX(salary) FROM employees);
- The inner query finds the highest salary.
- The outer query finds the maximum salary that is less than the highest.