MySQL SQLLesson 13Free preview
MySQL NULL Values
This lesson is part of MySQL · All levels
Summary
The value NULL means data is unknown or unfilled, not equal to zero or empty string. Because of this particular property, comparing NULL with the operator = or <> will always produce UNKNOWN so that the line does not appear. To check NULL, use the special clauses IS NULL and IS NOT NULL.
Key points
- NULL is an unknown value marker, different from 0, '', and spaces
- Comparisons such as columns = NULL never TRUE; mandatory use of IS NULL
- Columns that allow NULL should not be given a PRIMARY KEY
- Use DEFAULT or NOT when each row must always have a value
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.