융무의 기술블로그
article thumbnail

https://leetcode.com/problems/second-highest-salary/

 

Second Highest Salary - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

1. Problem                                                                                                                      

2. Analysis                                                                                                                     

1.  2번째로 높은 salary를 구해야 하기 때문에 where절에 서브쿼리를 이용해서 구했다.

 

3. Solution                                                                                                                    

<sql />
SELECT MAX(Salary) AS SecondHighestSalary FROM Employee WHERE Salary < (SELECT MAX(Salary) FROM Employee);

 

profile

융무의 기술블로그

@융무

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!