Skip to main content
SQL โ€ข LESSON 59

Top Results

How can we find the five highest-paid employees?

Beginnerโฑ 3 Minutesโญ 720 XP
๐Ÿค” THE QUESTION

How can we find the five highest-paid employees?

๐Ÿ’ก WHAT IS IT?

Combining ORDER BY DESC with LIMIT N retrieves the top N records ranked by a specified metric.

๐ŸŽฏ WHAT IS IT USED FOR?

Top 5 sales performers, highest volume transactions, fastest processing times.

๐Ÿ’ป EXAMPLE
SELECT name, salary
FROM employees
ORDER BY salary DESC
LIMIT 5;

๐ŸŽฏ Mission Objectives

Practice typing production-grade SQL code for Top Results.

  • โœ“ Top-N query
  • โœ“ ORDER BY DESC + LIMIT
  • โœ“ Leaderboard pattern
  • โœ“ Salary ranking