DEFAULT Clause
noun
say it: “dih-FAWLT KLAWZ” /dɪˈfɔlt klɔːz/
The part of a SQL column definition that gives the value to use when an INSERT leaves that column out.
What does DEFAULT Clause do in a relational database?
DEFAULT Clause — A clause providing a value when an INSERT omits the column.
CREATE TABLE customer (
customer_id INTEGER PRIMARY KEY,
email CHARACTER VARYING(255) NOT NULL,
status CHARACTER VARYING(20) DEFAULT 'active'
);
In a sentence
- “Without a DEFAULT clause, a column the INSERT skips is NULL.”
- “The DEFAULT clause on created_at filled in the time for every new row.”
Level: Novice · More SQL terms at this level
Updated