In MySQL, the NOT NULL constraint is used to restrict a column to NOT accept NULL values.
The NOT NULL constraint allows a column to always contains a value which means you cant not insert/update a record in a table without passing value for that column on which you have applied the NOT NULL constraint.
The below statement doesn't allow to "id" column and "first_name" column to accept NULL values:
Example
CREATE TABLE emplyee
(
id int NOT NULL,
first_name varchar(45) NOT NULL,
last_name varchar(45),
country varchar(45)
);
Hope this will help you :)
0 Comment(s)