What is NOT NULL Constraint?

What is NOT NULL Constraint?

What is NOT NULL Constraint?

View Answers

November 19, 2010 at 12:56 PM

Hi,

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-

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

Thanks,


November 19, 2010 at 3:28 PM

hi,

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









Related Tutorials/Questions & Answers:
What is the use of CASCADE CONSTRAINTS?
Use of CASCADE CONSTRAINTS
Advertisements
ModuleNotFoundError: No module named 'constraints'
ModuleNotFoundError: No module named 'magic_constraints'
ModuleNotFoundError: No module named 'tox-constraints'
ModuleNotFoundError: No module named 'django_database_constraints'
ModuleNotFoundError: No module named 'django-db-constraints'
ModuleNotFoundError: No module named 'odoo8-addon-account-constraints'
ModuleNotFoundError: No module named 'odoo8-addon-account-constraints'
ModuleNotFoundError: No module named 'openlabs_sale_quantity_constraints'
ModuleNotFoundError: No module named 'tox-constraints-canary'
ModuleNotFoundError: No module named 'django_database_constraints'
ModuleNotFoundError: No module named 'django-db-constraints'
what is bit
what is hibernate.archive.autodetection
what is hibernate.archive.autodetection
what is hibernate.archive.autodetection
what is hibernate.archive.autodetection
what is hibernate.archive.autodetection
What is procedure
what is hibernate.archive.autodetection
What is Hibernate
What is Hibernate
What is Hibernate
What is JDBC?
What is FBT
What is ActionServlet?
What is Trigger?
What is VLR ?
What's PHP ?
What is an interface?
What is DML?
What is Index?
What is SQLLoader?
What is a "constraint"?
what is Savepoint ?
What is this keyword?
what is collections?
what are indices?
What is Hibernate
What is Externalizable?
What is the % operator?
What is casting?
What is DataAccessException?
What is IOC ?
What is SQLExceptionTranslator?
What are Struts?
What is WAP?
What is SPOOL?
What is CRM?

Ads