Types & NULL
A blank-looking cell can mean three different things: 0, '', or no value at all. The database makes you commit up front, the column carries that decision into every comparison and count it ever sees.
- ▸Pick the type and whether a value may be missing before any row arrives. The database enforces both at insert.
- ▸Compare a value to a missing one, the answer is neither TRUE nor FALSE, and filters silently drop it.
- ▸The right question for a column that allows missing values isn't 'why not?', it's 'what does missing mean here?'
A users row arrives with five pieces: an id of 1, the name Ada, the email ada@x.example, a timestamp 2026-01-12 09:00:00, and a flag that says the account is active. Five values, four kinds. The table's job is to declare what each column accepts before any row shows up, and bounce anything that doesn't fit.
Whole numbers go in their own kind of column. Place the id there and 1, 2, 9999 land cleanly; in PostgreSQL, an attempt to insert the string 'seven' raises a type error, the row never lands. Strings, anything quotable, go in string columns; name and email accept any quoted value of any length. Dates and times go in their own kind too, with a separate variant that records the moment in UTC, for times entered from different time zones. True-or-false flags go in their own kind too.
Four kinds cover this table, and each one unlocks one downstream move: numeric columns sum and average, string columns match and search, date-time columns sort chronologically, true-or-false columns branch. The kind is one of two commitments the column makes up front, the second commitment (whether the column accepts the marker for absent) is next.