Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  

What is NOT NULL Constraint?



Share on Google+Share on Google+

hemant kumar
What is NOT NULL Constraint?
2 Answer(s)      6 years and 9 months ago
Posted in : SQL

What is NOT NULL Constraint?

View Answers

November 19, 2010 at 12:56 PM


The NOT NULL constraint enforces a column to NOT accept NULL values.The NOT NULL constraint enforces a field to always contain a value. This means that you cannot insert a new record, or update a record without adding a value to this field.

for example-

   item_num INTEGER,
   manufcode CHAR(3) NOT NULL,
   promotype INTEGER,
   descrip CHAR(20))


November 19, 2010 at 3:28 PM


the Not Null constraint can be declared to a column in which you are not supposed to enter a null vale i.e you can't leave it as blank. If you had declare an column with not null then you must enter a value.

Create table stud( sid number not null, sname varchar2(20) not null, pno number);

While inserting values

101 praveen ;//accepted rajesh 1234568;//not accepted throws an error 101 123456;//not accepted throws an error