Forbidding Nulls with NOT NULL

A column’s nullability determines whether its rows can contain nulls—that is, whether values are required or optional in the column. I described nulls and their effects in “Nulls” in Chapter 3, but I’ll review the basics here:

  • A null is not a value but a marker that means no value has been entered.

  • A null represents a missing, unknown, or inapplicable value. A null in the column price doesn’t mean that an item has no price or that its price is zero; it means that the price is unknown or has not been set.

  • A null isn’t the same as zero (0), a blank, or an empty string (" ").

  • Nulls belong to no data type and can be inserted into any column that permits nulls.

  • In SQL statements, the keyword NULL represents a null.

When ...

Get SQL: Visual QuickStart Guide 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.