SQL Constraint Unique

Опубликовано: 19 Февраль 2026
на канале: Study Desk of Anand
77
25

SQL Constraint Unique
In this video, we will see Unique constraint with practical example.
UNIQUE - Ensures that all values in a column are different
Syntax:
CREATE TABLE tbl_name (
col1 data_type UNIQUE,
... );
OR
CREATE TABLE tbl_name (
col1 data_type,
col2 data_type, ... ,
CONSTRAINT cons_name UNIQUE (col1, col2) );
OR
ALTER TABLE tbl_name
ADD UNIQUE (col_name)