DEFAULT
A column clause giving the value the database stores when an insert does not supply one.
In more detail
stock INTEGER NOT NULL DEFAULT 0 means a new product starts with an honest zero rather than a missing value. PostgreSQL defaults can also be expressions, such as today's date.
Related terms
- NOT NULL — A constraint that a column must always hold a value, so NULL is rejected.
- INSERT — The SQL statement that adds new rows to a table.
- CREATE TABLE — The SQL statement that defines a new table: its name, columns, types and constraints.
Taught in
- Data Types And What To Choose — PostgreSQL, Indexing & Relational Data Modeling