Select Employees With Top Three Salaries
Find employees whose salary is one of the top 3 distinct salaries.
sql
SELECT id, name, salary FROM employees WHERE salary IN ( SELECT DISTINCT salary FROM employees ORDER BY salary DESC LIMIT 3 );
This query identifies employees whose salary matches any of the three highest distinct salary values by using a subquery to isolate those top values and filtering the main table accordingly.
PromptDB can make mistakes. Please double-check responses.