DEFAULT Constraint

Also known as · DEFAULT

A Constraint that supplies a value when none is given. Unlike the other constraints, which make an INSERT or UPDATE fail on bad input, DEFAULT fixes the missing data.

sql
title VARCHAR(32) NOT NULL DEFAULT ''

When to use

PP 04 Q4.2 asks how DEFAULT differs from the other constraints. PP 03 Q5.2: title VARCHAR(32) NOT NULL DEFAULT '' lets an INSERT INTO leave title out, and it becomes the empty string.

See PP 03.

Appears in