In SQL, the
NULLvalue is never true in comparison to any other value, evenNULL. An expression that containsNULLalways produces aNULLvalue 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 anexpr = NULLtest. To look forNULLvalues, you must use theIS NULLtest.When using
DISTINCT,GROUP BY, orORDER BY, allNULLvalues are regarded as equal.When using
ORDER BY,NULLvalues are presented first, or last if you specifyDESCto sort in descending order.For some data types, MySQL handles NULL values specially. If you insert
NULLinto aTIMESTAMPcolumn, the current date and time is inserted.If you insert
NULLinto an integer or floating-point column that has theAUTO_INCREMENTattribute, the next number in the sequence is inserted.A column that has a
UNIQUEkey defined can still contain multipleNULLvalues.
Saturday, August 16, 2014
All about NULL
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment