Skip to main content

Posts

Showing posts with the label Not Null Constraint In SQL

Not Null Constraint In SQL

 Not Null Constraint: ====================   -Restricted nulls but accepting duplicates      -Not null an not be applied at table level ex:: create table test1(eid int not null,ename varchar2(10) not null); EX:: SQL> create table test1(eid int not null,ename varchar2(10) not null); Table created. SQL> insert into test1 values(10,'raja'); 1 row created. SQL> insert into test1 values(20,'dan'); 1 row created. SQL> select * from test1;        EID ENAME ---------- ----------         10 raja         20 dan SQL> insert into test1 values(null,'dan'); insert into test1 values(null,'dan')                          * ERROR at line 1: ORA-01400: cannot insert NULL into ("SYSTEM"."TEST1"."EID") SQL> insert into test1 values(10,null); insert into test1 values(10,null)                             * ERROR at line 1: ORA-01400: cannot insert NULL into ("SYSTEM"."TEST1"."ENAME") SQL> select *