DEFAULT value specifies a value to write into the constrained column if one is not defined in an INSERT statement. The value may be either a hard-coded literal or an expression that is evaluated at the time the row is created.
Details
- The of the
DEFAULTvalue must be the same as the data type of the column. - The
DEFAULTvalue constraint only applies if the column does not have a value specified in the statement. You can still insert aNULLinto an optional (nullable) column by explicitly insertingNULL. For example,INSERT INTO foo VALUES (1, NULL);.
Syntax
DEFAULT value constraint to individual columns.
You can also add the
DEFAULT value constraint to an existing table through .| Parameter | Description |
|---|---|
table_name | The name of the table you’re creating. |
column_name | The name of the constrained column. |
column_type | The constrained column’s . |
default_value | The value you want to insert by default, which must evaluate to the same as the column_type. |
column_constraints | Any other column-level you want to apply to this column. |
column_def | Definitions for any other columns in the table. |
table_constraints | Any table-level you want to apply. |
Example
DEFAULT value constraint is not specified and an explicit value is not given, a value of NULL is assigned to the column.

