Top three earners
An SQL exercise from Querydrill. Solve it with a SQL editor in your browser, checked on the rows it returns and again on changed data, and it is checked the moment you submit.
The task
Return the name and salary of the three highest-paid employees, highest salary first.
What this exercise teaches
ORDER BY decides the sequence and LIMIT trims it. Without ORDER BY, LIMIT returns an arbitrary set.
A hint if you get stuck
Sort with ORDER BY ... DESC, then cut the list with LIMIT.
Try it now, no account needed
This exercise is free. Open it on the practice page, solve it, and get instant feedback with a hint and a worked solution after two tries.
Open this exercise