NULLS FIRST and NULLS LAST

ORDER BY options that say whether NULL values sort before or after all other values.

In more detail

The databases disagree by default: SQLite puts NULLs first when sorting ascending and PostgreSQL puts them last. Both accept NULLS FIRST and NULLS LAST, so say which you want whenever a sort column can be empty.

Example

ORDER BY manager_id NULLS LAST

Related terms

Taught in

References