MySQL DatabaseLesson 53Free preview
MySQL Not Null
This lesson is part of MySQL · All levels
Summary
Constraint NOT NULL requires a column to always contain a value every time a line is created or changed. Without the NOT NULL, the column is allowed to store the value NULL which means the value is unknown or has not been filled. It is necessary to distinguish between NULL and empty strings, because they are different things in MySQL.
Key points
- NOT NULL refuses to store the value NULL on the column
- By default columns without NOT NULL are allowed to have a value NULL
- NULL means unknown, as opposed to empty string ''
- Find NULL using IS NULL / IS NOT NULL, not = NULL
- Timestamp and certain columns can be automated NOT NULL according to MySQL mode
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.