SQL -Structured Query Language - Sql Key & Constraint - Primary Key Tutorial
Primary Key Constraint is used, when we want each record to be uniquely identified. Column defines with Primary key Constraint will never repeat its value and cannot be null.
The syntax for the primary key-
create table user_detail
(
id int primary key,
name varchar(50) not null,
email varchar(50) unique,
DOB date
);
In this, we define id with the primary key constraint. Hence it will always remain unique and cannot be null for the user_detail table.