7.04 – Order By


Previous: 7.03 - Where Clauses

When you need to sort the results of a SELECT statement, you can use the ORDER BY keyword. You can use ASC for "ascending", or DESC for "descending".

Example 1 shows a use of the ORDER BY keyword.

Example 1
SELECT * FROM Students
WHERE FirstName = "William"
ORDER BY LastName ASC



Change the code in Example 1 to show the results from youngest to oldest.

Tap/click to reveal SELECT * FROM Students
WHERE FirstName = "William"
ORDER BY DateOfBirth DESC





Next: 7.05 - Insert Into



© Rujul Nayak 2024-