The PRIMARY KEY constraint is used to uniquely identify each row in a table. A PRIMARY KEY must contain unique values and it can’t contain a null value. A table can have only one primary key. We can use multiple columns or fields to define a primary key, such primary key is known as composite key.
Syntax of PRIMARY KEY Constraint on one column with CREATE TABLE statement:
MySQL:
SQL Server / Oracle / MS Access:
Syntax of PRIMARY KEY Constraint on one column with ALTER TABLE statement:
MySQL / SQL Server / Oracle / MS Access:
Syntax of PRIMARY KEY Constraint on multiple columns with CREATE TABLE statement:
MySQL / SQL Server / Oracle / MS Access:
Syntax of PRIMARY KEY Constraint on multiple columns with ALTER TABLE statement:
MySQL / SQL Server / Oracle / MS Access:
Delete PRIMARY KEY:
Use following syntax to delete the primary key.
No comments:
Post a Comment