Defaults as Alternatives to NULLs

One alternative to a NULL is a default, a value entered by the database management system when the user provides no explicit value. SQL allows you to specify defaults in the CREATE TABLE command (and the ALTER TABLE command).

One of the advantages of defaults over NULLs is that you can give a particular column an appropriate value, instead of having to rely on NULL everywhere. A good default for the type column might be “unknown,” while a good default for the date column might be today's date. On the other hand, defaults of zero (for numeric columns) or blank (for character columns) or “01/01/0000” (for date columns) ...

Get Practical SQL Handbook, The: Using SQL Variants, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.