Sort the result set by one or more columns.
Sorts the result set by one or more columns in ascending (default) or descending order. Always evaluated last in the query pipeline, after WHERE, GROUP BY, and HAVING. Sorting large result sets is expensive; push sorting to application logic when possible.
| Database System | Support Status | Since Version | Notes |
|---|---|---|---|
| MySQL | ✓ Supported | all | NULLS LAST via ISNULL() |
| PostgreSQL | ✓ Supported | all | NULLS FIRST/LAST |
| SQL Server | ✓ Supported | all | No NULLS FIRST/LAST |
| Oracle | ✓ Supported | all | NULLS FIRST/LAST |
| SQLite | ✓ Supported | all | No NULLS FIRST/LAST |
Defines row sort order.
NULLS LAST via ISNULL()
NULLS FIRST/LAST
No NULLS FIRST/LAST
NULLS FIRST/LAST
No NULLS FIRST/LAST