Difference between revisions of "NULL Column Constraint"

From Lianjapedia
Jump to: navigation, search
m (1 revision: SQL)
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
 
Column constraint to allow NULL values
 
Column constraint to allow NULL values
 
  
 
==Syntax==
 
==Syntax==
 
NULL
 
NULL
 
  
 
==See Also==
 
==See Also==
 
[[ALTER TABLE]], [[SQL Constraints|CONSTRAINTS]], [[CREATE TABLE]]
 
[[ALTER TABLE]], [[SQL Constraints|CONSTRAINTS]], [[CREATE TABLE]]
 
  
 
==Description==
 
==Description==
Line 15: Line 12:
  
 
The NULL column constraint is used to specify that the column can contain NULL values.  The NOT NULL column constraint can be used to disallow NULL values.
 
The NULL column constraint is used to specify that the column can contain NULL values.  The NOT NULL column constraint can be used to disallow NULL values.
 
  
 
==Example==
 
==Example==
Line 25: Line 21:
 
</code>
 
</code>
  
 
==Products==
 
Recital, Recital Server
 
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:SQL]]
 
[[Category:SQL]]

Revision as of 08:11, 7 December 2012

Purpose

Column constraint to allow NULL values

Syntax

NULL

See Also

ALTER TABLE, CONSTRAINTS, CREATE TABLE

Description

A constraint is used to define rules that help to provide data integrity. Column constraints are specific to the column name specified. You must have ALTER privilege on the table. The table will be locked for EXCLUSIVE use during the operation.

The NULL column constraint is used to specify that the column can contain NULL values. The NOT NULL column constraint can be used to disallow NULL values.

Example

ALTER TABLE customer;
  ADD COLUMN custref CHAR(5) NULL
ALTER TABLE customer;
  ALTER COLUMN custref NOT NULL