Unique Key
Unique Key : – Unique Key does not allow duplicate value but it accept NULL value many times (As every null is unique and never equal to another null).
1) Unique Key (Column Level) :-
a) With System defined name
SQL>create table student(regno number(10) unique, name varchar2(10), dob date, course varchar2(10));
b) With User defined name
SQL>create table student(regno number(10) constraint uk_regno unique,
name varchar2(10),dob date,course varchar2(10));
2) Unique Key (Table Level) :-
a) With System defined name
SQL>create table student(regno number(10),name varchar2(10),dob date,course varchar2(10), unique(regno));
b) With User defined name
SQL>create table student(regno number(10),name varchar2(10),dob date,course varchar2(10),constraint uk_regno unique(regno));
3) Composite Unique Key :- Unique Key created for more than one column is called Composite Unique Key.
a) With System defined name
SQL>create table student(regno number(10),name varchar2(10),dob date,course varchar2(10), unique(regno,name));
b) With User defined name
SQL>create table student(regno number(10),name varchar2(10),dob date,course varchar2(10),constraint uk_regno unique(regno,name));
--------------------------HAPPY LEARNING -----------------------------
**THANK YOU**