Comments - ORDER BY

2 months ago Ingo Tomahogh-Willms

At least in MariaDB 10.5.8, NULL is ordered as lowest value.

Therefore,

ORDER BY -updated_at

and

ORDER BY updated_at DESC

are not the same if the updated_at (datetime) column contains some NULL values: The first one will sort NULLs first, the second one sorts NULL values last, while both sort actual datetimes in descending order.

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.