176.Second-Highest-Salary
176. Second Highest Salary
้ข็ฎๅฐๅ
https://leetcode.com/problems/second-highest-salary/
้ข็ฎๆ่ฟฐ
ไปฃ็
Approach #1 Using sub-query and LIMIT
clause
LIMIT
clauseHowever, this solution will be judged as 'Wrong Answer' if there is no such second highest salary since there might be only one record in this table. To overcome this issue, we can take this as a temp table.
Approach #2 Using IFNULL
and LIMIT
clause
IFNULL
and LIMIT
clauseAnother way to solve the 'NULL' problem is to use IFNULL
funtion as below.
Last updated