By default, a column can hold NULL. If you do not want to allow NULL value in a column, you will want to place the NOT NULL constraint on this column. The NOT NULL constraint specifies that NULL is not an allowable value.
For example, in the following statement,
CREATE TABLE Customer
(SID integer NOT NULL,
Last_Name varchar (30) NOT NULL,
Columns "SID" and "Last_Name" cannot include NULL, while "First_Name" can include NULL.
An attempt to execute the following SQL statement,
INSERT INTO Customer (Last_Name, First_Name) VALUES ('Smith', 'Ken');
will result in an error because this will lead to column "SID" being NULL, which violates the NOT NULL constraint on that column.
Next: SQL DEFAULT Constraint
|| Copyright © 2013 1keydata.com All Rights Reserved.