Nested MAX with a subquery
SELECT
MAX(salary) AS second_highest
FROM employees
WHERE salary < (
SELECT MAX(salary)
FROM employees
)The inner query finds the global maximum salary. The outer query then restricts the table to salaries below that maximum and takes the maximum of the remaining values. This is compact, easy to explain in an interview, and works well when you only need the second distinct tier.