Search

UNIQUE



This is used to avoid duplicates but it allow nulls.
We can add this constraint in all three levels.

Ex:
      COLUMN LEVEL

     SQL> create table student12(no number(2) unique, name varchar(10), marks
             number(3));
      SQL> create table student12(no number(2)  constraint un unique, name varchar(10),
             marks number(3));

       TABLE LEVEL
     
      SQL> create table student12(no number(2) , name varchar(10), marks number(3),
             unique(no));
      SQL> create table student12(no number(2) , name varchar(10), marks number(3),
             constraint un unique(no));

      ALTER LEVEL

      SQL> alter table student12 add unique(no);
      SQL> alter table student12 add constraint un unique(no);