PRIMARY KEY
Description
The PRIMARY KEY constraint uniquely identifies each record in a table.
Primary keys must contain UNIQUE values, and cannot contain NULL values.
A table can have only ONE primary key; and in the table, this primary key can consist of single column (field).
SQL PRIMARY KEY on CREATE TABLE
The following SQL creates a PRIMARY KEY on the “ID” column when the “Persons” table is created:
> CREATE TABLE Persons (
ID int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Age int,
PRIMARY KEY (ID)
);
Constraints
DROP PRIMARY KEY
withALTER TABLE
is not supported yet.- Composite primary key(the primary key consists of multiple columns) is not supported yet.