Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Sorting by Multiple Columns | Sorting Data
Introduction to SQL

bookSorting by Multiple Columns

Summary:

  • The retrieved data can be sorted with respect to the values of multiple columns as well using the ORDER BY clause;
  • The general syntax of the ORDER BY clause is: SELECT column1, column2, … FROM table_name ORDER BY columnA [ASC|DESC], columnB [ASC|DESC], …;;
  • SELECT name, age FROM students ORDER BY age, first_name.
question mark

In case of the expression ORDER BY age, first_name, the fetched rows are sorted first by:

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 3

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Suggested prompts:

Ask me questions about this topic

Summarize this chapter

Show real-world examples

Awesome!

Completion rate improved to 1.72

bookSorting by Multiple Columns

Swipe to show menu

Summary:

  • The retrieved data can be sorted with respect to the values of multiple columns as well using the ORDER BY clause;
  • The general syntax of the ORDER BY clause is: SELECT column1, column2, … FROM table_name ORDER BY columnA [ASC|DESC], columnB [ASC|DESC], …;;
  • SELECT name, age FROM students ORDER BY age, first_name.
question mark

In case of the expression ORDER BY age, first_name, the fetched rows are sorted first by:

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 3
some-alt