SQL NOT NULL constraint
In case of default, a table column accepts NULL values.
SQL NOT NULL constraint
NOT NULL constraints forced the column does not accept NULL values.
NOT NULL constraint mandatory field always contains a value. This means that if you do not add value to a field, you can not insert a new record or update the record.
The following SQL mandatory "P_Id" column and the "LastName" column does not accept NULL values:
CREATE TABLE Persons
(
P_Id int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255)
)
(
P_Id int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255)
)