-
176. Second Highest Salary mysqlLeetCode_Study_Plan/SQL 2022. 10. 2. 14:00
https://leetcode.com/problems/second-highest-salary/?envType=study-plan&id=sql-i
SELECT IFNULL( (SELECT DISTINCT Salary FROM Employee ORDER BY Salary DESC LIMIT 1 OFFSET 1), NULL) AS SecondHighestSalary;
offset을 활용하여 페이징처리 가능한데, desc해서 두 번째 값을 가져오고 싶을 땐 odffset을 적절하게 활용할 수 있는 것 같다.
'LeetCode_Study_Plan > SQL' 카테고리의 다른 글
1693. Daily Leads and Partners mysql (0) 2022.10.02 1141. User Activity for the Past 30 Days I mysql (0) 2022.10.02 608. Tree Node mysql (0) 2022.10.02 607. Sales Person mysql (0) 2022.09.30 197. Rising Temperature mysql (0) 2022.09.30