×
☰ See All Chapters

Not null and null constraint in Oracle

The NOT NULL modifier prevents NULL (a token (non-zero) that designates a column as being empty) values from appearing in the column. NULL allows null values. Example every persons will not be having PHONE for which we can use NULL constraint.

Syntax to create table with not null and null constraint in Oracle

CREATE TABLE <table-name>

(

<column-name1> <data-type(size)> NOT NULL,

<column-name2> <data-type(size)> NULL

);

Example to create table with not null and null constraint in Oracle

CREATE TABLE CUSTOMER

(

CUSTOMER_ID INT NOT NULL,

PHONE  NUMBER(10)  NULL

);

 

 

 

 

 

 

 


All Chapters
Author