ORDER BY & LIMIT · SQL
Ch 2 · Sorting & Filtering — card 1 of 2.
ORDER BY sorts results (DESC = highest first). LIMIT caps how many rows — great for "top N". In the example, employees are sorted from highest to lowest salary and only the first three rows come back, so you get the three best-paid people. Try removing DESC to see the order flip, or change the number after LIMIT.
SELECT first_name, last_name, salary FROM employees ORDER BY salary DESC LIMIT 3;