Defaults are applied only when no value is specified for a column during an insertion. They can also be applied during insertions and updates when the
DEFAULT keyword is used. To demonstrate the application of defaults, consider the following examples:
CREATE TABLE test_default(id int IDENTITY NOT NULL, tmstmp timestamp NOT NULL, password char(13) NOT NULL DEFAULT 'defaultpw', Shortdesc VARCHAR(50) NULL)
The table in this example has a unique characteristic: each column has some sort of default value associated with it. One column has a default of
NULL because it is nullable. The
TIMESTAMP columns automatically generate values because of their data type, and the password column ...