#1 most askedVery commonMediumSubqueries
Second-Highest Salary
New to Subqueries? Learn it from scratch firstSubqueries & CTEs โ
๐ข Asked in real interviews
No reports yet. Were you asked this? Be the first to say where.Table employees(id, name, department_id, manager_id, salary, hire_date, email).
Return the second-highest distinct salary as one column named second_highest. If there isn't one, return NULL.
๐งช Practice
Write the query, then press Run tests to compare your rows with the expected result.
SELECT * FROM employees;
Output appears here. Press Run or Ctrl/โ + Enter.
Try it first. Struggling for a few minutes is how it sticks.