Saturday, August 16, 2014

All about NULL

  • In SQL, the NULL value is never true in comparison to any other value, even NULL. An expression that contains NULL always produces a NULL value unless otherwise indicated in the documentation for the operators and functions involved in the expression.
  • To search for column values that are NULL, you cannot use an expr = NULL test. To look forNULL values, you must use the IS NULL test.
  • When using DISTINCTGROUP BY, or ORDER BY, all NULL values are regarded as equal.
  • When using ORDER BYNULL values are presented first, or last if you specify DESC to sort in descending order.
  • For some data types, MySQL handles NULL values specially. If you insert NULL into a TIMESTAMP column, the current date and time is inserted.
  • If you insert NULL into an integer or floating-point column that has the AUTO_INCREMENTattribute, the next number in the sequence is inserted.
  • A column that has a UNIQUE key defined can still contain multiple NULL values.

No comments:

Post a Comment