PostgreSQL row sort with NULL values and empty string at last December 26, 2023 by Tarik Use some conditional functions, e.g. ORDER BY NULLIF(first_name, '') DESC NULLS LAST