NOT NULL in SQL is a constraint applied to a column in a table, ensuring that the column cannot have a NULL
value. When a column is defined with the NOT NULL
constraint, every row must have a valid, non-null value in that column. This ensures data integrity by preventing missing or unknown values where they are not allowed.
For example, if a name
column is defined as VARCHAR(50) NOT NULL
, any attempt to insert a row without a name or with a NULL
value will result in an error.
Top comments (0)