Primary Keys : PRIMARY KEY « Table « MySQL Tutorial






A primary key data must be unique.

Only one primary key can exist for each table.

A primary key values can never be null.

MySQL requires you to specify NOT NULL when creating a table with a given column specified as PRIMARY KEY.









4.15.PRIMARY KEY
4.15.1.Primary Keys
4.15.2.Create primary key in column definition
4.15.3.Create primary key after column definition
4.15.4.Multiple-Column Primary Keys
4.15.5.Auto_INCREMENT primary key
4.15.6.Use two columns as the combined primary key
4.15.7.Use partial indexing as the primary key
4.15.8.ALTER TABLE table_name ADD PRIMARY KEY index_name (column_name[,...]);
4.15.9.To drop a PRIMARY KEY
4.15.10.To remove a primary key
4.15.11.Alter table to drop primary key and foreign key
4.15.12.Add Index and primary key to a table in table creation command