← All SQL interview questions

Third highest salary in every department

HardSubqueriesOracleWalmartEXL

Compensation benchmarking needs the third highest distinct salary inside each department.

From payroll_records, return department and third_highest_salary. Departments with fewer than three distinct salaries must be omitted entirely.

Sample data

Practising alone only goes so far — our live cohorts pair SQL depth with dashboards, agentic analytics projects and mock interviews.

Explore the program