SQL Getting Sta...login
SQL Getting Started Tutorial Manual
author:php.cn  update time:2022-04-12 14:15:40

SQL NOT NULL



By default, table columns accept NULL values.


SQL NOT NULL constraint

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

NOT NULL constraint forces the field to always contain a value. This means that you cannot insert a new record or update a record without adding a value to the field.

The following SQL forces the "P_Id" column and the "LastName" column not to 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)
)

php.cn