DDSA Solutions

176. Second Highest Salary

Advertisement

About this solution

Second Highest Salary is a unknown-difficulty LeetCode problem covering the Database pattern. The MySQL solution below uses an idiomatic approach that is clean, readable, and directly submittable on LeetCode. Study the logic carefully — recognising the underlying pattern is the key skill that transfers to similar problems in interviews.

Key Techniques

176.sql
MySQL
/* Write your T-SQL query statement below */
SELECT  MAX(salary) AS SecondHighestSalary
FROM Employee
WHERE salary < (
SELECT  MAX(salary)
FROM Employee);
Advertisement
Was this solution helpful?