CREATE UNIQUE INDEX

SQL CREATE UNIQUE INDEX Keyword

The CREATE UNIQUE INDEX command is used to create an index on a column that does not allow duplicate values. Indexes are used to improve the speed of data retrieval without changing the visible structure of the table.

Tutorials dojo strip

SQL CREATE UNIQUE INDEX Syntax

CREATE UNIQUE INDEX index_name
ON table_name (column)

SQL CREATE UNIQUE INDEX Example

This creates a unique index named uidx_patientid on the patient_id column of the Patients table. The index enforces uniqueness which means no two records can have the same patient_id.

CREATE UNIQUE INDEX uidx_patientid
ON Patients (patient_id)

SQL CREATE UNIQUE INDEX Labs

Tutorials dojo strip
Scroll to Top