Skip to main content

Second & Nth Highest Salary Problems

Learn Second & Nth Highest Salary Problems (Advanced SQL Interview Problems, MySQL) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Introduction Classic question: return the Nth highest distinct salary. The cleanest MySQL 8 answer ranks salaries with DENSE_RANK() , which gives tied salaries the same rank and no gaps.

More lessons in Advanced SQL Interview Problems