Skip to main content
SQL โ€ข LESSON 84

JOIN with Sorting

How can we list employees with their department names ordered alphabetically?

Intermediateโฑ 3 Minutesโญ 970 XP
๐Ÿค” THE QUESTION

How can we list employees with their department names ordered alphabetically?

๐Ÿ’ก WHAT IS IT?

ORDER BY applies structured sorting across attributes projected from multiple joined tables.

๐ŸŽฏ WHAT IS IT USED FOR?

Alphabetical staff directories, hierarchically sorted organizational rosters.

๐Ÿ’ป EXAMPLE
SELECT e.name, d.department_name
FROM employees e
JOIN departments d
ON e.department_id = d.department_id
ORDER BY d.department_name, e.name;

๐ŸŽฏ Mission Objectives

Practice typing production-grade SQL code for JOIN with Sorting.

  • โœ“ JOIN + ORDER BY
  • โœ“ Hierarchical sorting
  • โœ“ Multi-table ordering
  • โœ“ Production readability