Basic Sorting
Note
The rows fetched by a
SELECTstatement are ordered by default based on the date and time of insertion, with the oldest inserted row at the top and the most recently inserted row at the bottom. In the upcoming sections, we will learn how to insert rows into tables.
Summary:
- We can sort the results of a 
SELECTstatement by using anORDER BYclause; - The syntax of the 
ORDER BYclause is:ORDER BY column_name [ASC|DESC]; - The keywords 
ASCorDESCcan be optionally used to specify the sorting order; - Usage Example: 
SELECT * FROM students ORDER BY age DESC. 
1. Which clause can be used for ordering the retrieved data?
2. What is the correct syntax for using the ORDER BY clause?
Everything was clear?
Thanks for your feedback!
SectionΒ 3. ChapterΒ 1
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 1.72
Basic Sorting
Swipe to show menu
Note
The rows fetched by a
SELECTstatement are ordered by default based on the date and time of insertion, with the oldest inserted row at the top and the most recently inserted row at the bottom. In the upcoming sections, we will learn how to insert rows into tables.
Summary:
- We can sort the results of a 
SELECTstatement by using anORDER BYclause; - The syntax of the 
ORDER BYclause is:ORDER BY column_name [ASC|DESC]; - The keywords 
ASCorDESCcan be optionally used to specify the sorting order; - Usage Example: 
SELECT * FROM students ORDER BY age DESC. 
1. Which clause can be used for ordering the retrieved data?
2. What is the correct syntax for using the ORDER BY clause?
Everything was clear?
Thanks for your feedback!
SectionΒ 3. ChapterΒ 1