Skip to main content

Posts

Showing posts with the label unique constraint in sql

unique constraint in sql

Unique Constraint:: ================  -Restricted Duplicates values but accepting nulls into a column column level:: ============ >create table test1(sno int unique,name varchar2(10) unique); EX:: SQL> create table test1(eid int unique,ename varchar2(10) unique); Table created. SQL> insert into test1 values(10,'virat'); 1 row created. SQL> select * from test1;        EID ENAME ---------- ----------         10 virat SQL> insert into test1 values(10,'rohit'); insert into test1 values(10,'rohit') * ERROR at line 1: ORA-00001: unique constraint (SYSTEM.SYS_C007643) violated SQL> insert into test1 values(20,'virat'); insert into test1 values(20,'virat') * ERROR at line 1: ORA-00001: unique constraint (SYSTEM.SYS_C007644) violated SQL> insert into test1 values(20,'rohit'); 1 row created. SQL> select * from test1;        EID ENAME ---------- ----------         10 virat         20 rohit SQL> insert into test1(null,'