Skip to main content
SQL • LESSON 84

JOIN with Sorting

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

Intermediate3 Minutes970 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