Skip to content

Commit 5000832

Browse files
committed
modified: second-highest-salary.sql
1 parent 69da6ff commit 5000832

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

MySQL/second-highest-salary.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
# For example, given the above Employee table, the second highest salary is 200. If there is no second highest salary, then the query should return null.
1414
#
1515
# Write your MySQL query statement below
16-
SELECT MAX(Salary) FROM Employee
17-
WHERE Salary NOT IN (SELECT MAX(Salary) FROM Employee)
16+
select (SELECT MAX(Salary) FROM Employee WHERE Salary NOT IN (SELECT MAX(Salary) FROM Employee)) SecondHighestSalary;
17+
# or
18+
SELECT (SELECT Salary FROM Employee GROUP BY Salary ORDER BY Salary DESC LIMIT 1,1) SecondHighestSalary;

0 commit comments

Comments
 (0)