What is the difference between a DEFAULT value and a NOT NULL constraint?

Responsive Ad Header

Question

Grade: Education Subject: Support
What is the difference between a DEFAULT value and a NOT NULL constraint?
Asked by:
73 Viewed 73 Answers

Answer (73)

Best Answer
(385)
A DEFAULT value provides a default value for a column if no value is explicitly provided during insertion. A NOT NULL constraint *requires* a value to be provided during insertion; the default value is irrelevant. If a column has both a DEFAULT and a NOT NULL constraint, the DEFAULT value is used if no value is provided, but the database still enforces that a value must be present.