English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
NOT NULL constraint enforces that the column does not accept NULL values, which means you must insert or update a record without adding a value to the field.
The following SQL ensures that the "ID", "LastName", and "FirstName" column will not accept NULL values:
CREATE TABLE Persons ( ID int NOT NULL, LastName varchar(255) NOT NULL, FirstName varchar(255) NOT NULL, Age int );
When the 'Persons' table has been created, the following SQL can create a NOT NULL constraint on the 'age' column:
ALTER TABLE Persons MODIFY Age int NOT NULL;