SQL NOT NULL Constraint

SQL NOT NULL Constraint

NOT NULL constraint forces the column to not accept NULL values.

NOT NULL constraint forces the field to always contain a value. This means that new records cannot be inserted or records cannot be updated without adding a value to the field.

The following SQL statement enforces that the 'Id_P' column and 'LastName' column do not accept NULL values:

CREATE TABLE Persons
(
Id_P int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255)
)