Skip to main content
SQL โ€ข LESSON 04

ORDER BY

How can we sort query results in ascending or descending order?

Beginnerโฑ 2 Minutesโญ 150 XP
๐Ÿค” THE QUESTION

How can we sort query results in ascending or descending order?

๐Ÿ’ก WHAT IS IT?

ORDER BY sorts the returned rows by one or more specified columns in ASC or DESC direction.

๐ŸŽฏ WHAT IS IT USED FOR?

Creating leaderboards, sorting by latest dates, organizing records by numeric value.

๐Ÿ’ป EXAMPLE
SELECT *
FROM employees
ORDER BY salary DESC;

๐ŸŽฏ Mission Objectives

Practice typing production-grade SQL code for ORDER BY.

  • โœ“ ORDER BY
  • โœ“ DESC / ASC
  • โœ“ Sorting
  • โœ“ Column ordering