|
Constraints are specified when a table is created. They used to limit the type of data that can go into a table.
Here are some constraints which are commonly used with create table statement.
NOT NULL
UNIQUE
PRIMARY KEY
FOREIGN KEY
Example:
CREATE TABLE Users
(
U_Id int NOT NULL,
FirstName varchar(255),
LastName varchar(255),
City varchar(255),
PRIMARY KEY (U_Id)
) |