Primary key

A primary key is a column or a group of columns used to uniquely identify a row in a table. Technically, it is a combination of the NULL constraint and the UNIQUE constraint.

CREATE TABLE table_name ( column1 data_type PRIMARY KEY, column2
data_type, …) ;

In case the primary key consists of two or more columns, the primary key constraint is defined as follows.

CREATE TABLE table_name ( column1 data_type, column2 data_type, …
PRIMARY KEY (column1,col2) );

ALTER TABLE table_name ADD PRIMARY KEY (column1 , column2);

If no name is specified, the system assigns a default name.

CONSTRAINT constraint_name PRIMARY KEY(col1, col2,...);

Deletion of constraint

ALTER TABLE table_name DROP CONSTRAINT primary_key_constraint;