This page is part of the book SQL-99 Complete, Really, by Peter Gulutzan & Trudy Pelzer. The authors have graciously allowed us to reproduce the contents of the book here. Because the book is about the SQL-99 standard, the contents of this and other pages in the book may not directly apply to MariaDB. Use the navigation bar to navigate the book.

It isn't usually possible to make meaningful comparisons with null values, so the following comparison rules are applicable only in the context of an ORDER BY clause:

  • A NULL is "equal" to a NULL for sorting purposes.
  • [NON-PORTABLE] Either a NULL is greater than all non-null values or a NULL is less than all non-null values it's non-standard because the SQL Standard requires implementors to define whether NULLs sort high or low. Most vendors say "NULLs are greater than all non-null values" in this case, a Table with these rows: {7,5,-1,NULL} will end up in this order: {-1,5,7,NULL} if you ask for an ascending sort. [OCELOT Implementation] The OCELOT DBMS that comes with this book sorts NULLs low: a NULL is less than all non-null values.

Comments

Comments loading...