5.2. UNIQUE
- The UNIQUE constraint ensures that all values in a column are different.
- Both the UNIQUE and PRIMARY KEY constraints provide a guarantee for uniqueness for a column or set of columns.
- A PRIMARY KEY constraint automatically has a UNIQUE constraint.
- However, you can have many UNIQUE constraints per table, but only one PRIMARY KEY constraint per table.
QUERY: - create table company (c_id int primary key identity, c_name nvarchar (25) unique , c_Turnover int);
- SQL UNIQUE on ALTER TABLE:-
QUERY: - ALTER TABLE Table_Name ADD UNIQUE (column);
EXAMPLE: - ALTER TABLE employee ADD UNIQUE (e_id);
Last modified: Monday, 2 December 2019, 12:17 PM