Sunday 6 December 2015

NOT NULL constraint

A constraint is a restriction or business rule which can be imposed on the data for managing data integrity. When a business rule is imposed on the data, the data cannot violate the rule.
When NOT NULL constraint is imposed on a column the column will not allow NULL values into it.
Syntax:
Create Table <table_name> <column 1><data type> [width][NOT NULL],…. <column N>< data type>[width][NOT NULL]
Example:
Create Table BANK (Customerid Int NOT NULL, Cname varchar (50), Balance Decimal (7, 2) NOT NULL)
Note: When a NOT NULL constraint is imposed on a column the column will not allow NULL values but allows duplicate values.

No comments:

Post a Comment