SQL NOT NULL Constraint

The SQL NOT NULL constraint ensures that the column contains no null values. Columns without the not null constraint can contain null values by default. This means that you cannot insert a new record, or update a record without adding a value to this field.

Example

Create table employee
(
Emp_id number(6) NOT NULL,
Emp_name varchar2(25),
Salary number(8,2),
Hire_date DATE NOT NULL
);

In the above example two fields named Emp_id and Hire_date are set with NOT NULL constraints, which ensures that while entering records in to this table the user can not save a record without entering values in to this two fields. The name of the constraints set with hire_date field is emp_hire_date where as the constraints set with emp_name field is not specified.



  Tutorials

Popular Links

Contact Us

address Plot No-741,2ND Floor
Opp. Bhagabati Temple,Jayadev Vihar
      Bhubaneswar-751013
      Email: info@silantechnology.com
      Phone: 0674-2361252
address
39877, sundale dr, apt#101, Fremont, California 94538, USA
       Phone: +1(262)388-7619

facebook twitter google linked in

© 2018 Silan Technology. All Rights Reserved