What is the Default Sort Order of ORDER BY?
✅ By default, ORDER BY sorts in:
Ascending (ASC) order — from smallest to largest, A → Z, 0 → 9.
If you don’t specify anything, this:
SELECT * FROM Employees
ORDER BY salary;
is the same as:
SELECT * FROM Employees
ORDER BY salary ASC;
✅ Default is ASC — Ascending:
- Numbers: lowest to highest (
1, 2, 3, 4...). - Text: alphabetical (
A, B, C...). - Dates: earliest to latest (
2023-01-01,2023-01-02…).
What if you want descending order?
You explicitly specify:
ORDER BY column_name DESC
Numbers: highest to lowest.
Text: Z → A.
Dates: latest to earliest.
Quick Example
| name | salary |
|---|---|
| Alice | 5000 |
| Bob | 7000 |
| Carol | 6000 |
Default ORDER BY salary:
SELECT * FROM Employees ORDER BY salary;
Result:
| name | salary |
|---|---|
| Alice | 5000 |
| Carol | 6000 |
| Bob | 7000 |
✅ Sorted ascending — lowest to highest salary.
Explicit ORDER BY salary DESC:
SELECT * FROM Employees ORDER BY salary DESC;
Result:
| name | salary |
|---|---|
| Bob | 7000 |
| Carol | 6000 |
| Alice | 5000 |
✅ Sorted descending — highest to lowest salary.
In Short
ORDER BYwithout ASC/DESC sorts inASC(ascending) order by default.