DEVFYI - Developer Resource - FYI

How do I disallow NULL values in a table?

JDBC Interview Questions and Answers


(Continued from previous question...)

How do I disallow NULL values in a table?

Null capability is a column integrity constraint, normally aplied at table creation time. Note that some databases won't allow the constraint to be applied after table creation. Most databases allow a default value for the column as well. The following SQL statement displays the NOT NULL constraint:
CREATE TABLE CoffeeTable (
Type VARCHAR(25) NOT NULL,
Pounds INTEGER NOT NULL,
Price NUMERIC(5, 2) NOT NULL

(Continued on next question...)

Other Interview Questions