Primary Key
A primary key is a column (or set of columns) that uniquely identifies each row in a table. No two rows can share the same primary key, and it can never be NULL.
SQL
Primary keys are the backbone of a relational database. They give every record a reliable, unique identifier — often an auto-incrementing id number — so you can find and reference rows without confusion.
Other tables refer back to a primary key using a foreign key, which is how relationships between tables are formed.
Syntax
CREATE TABLE table_name (
id INT PRIMARY KEY,
...
);Examples
SQL
CREATE TABLE customers (
id INT PRIMARY KEY,
email TEXT
);Output:
Each customer now has a unique id.