Last Updated: May 3, 2026
"Find the second highest salary." This is one of the most common SQL interview questions, and it is trickier than it looks. The difficulty comes from defining what "second highest" means when there are duplicate values, when there are NULLs, or when the table has fewer than N distinct values.
This chapter covers three approaches, each with different trade-offs around ties, portability, and performance.