Accepted answer using UNION to return NULL


  • 0
    H
    SELECT 
        e.Salary
    FROM Employee e
    WHERE (
        SELECT count(DISTINCT Salary) FROM Employee WHERE Salary > e.Salary
    ) = 1
    UNION (SELECT NULL) LIMIT 1;

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.