Skip to content

Not Null

Easy — everyone uses thisDatabase

ELI5 — The Vibe Check

NOT NULL is how you tell the database 'this field MUST have a value — you cannot leave it blank.' If you try to insert a row without it, the database throws a tantrum and refuses. Great for required fields.

Real Talk

NOT NULL is a column constraint that prevents NULL values from being stored in that column. When attempting to insert or update a row without providing a value for a NOT NULL column (and no DEFAULT is set), the database raises a constraint violation error.

Show Me The Code

CREATE TABLE posts (
  id SERIAL PRIMARY KEY,
  title TEXT NOT NULL,   -- required
  body TEXT              -- optional (nullable)
);

When You'll Hear This

"The title column is NOT NULL so every post must have one." / "I got a NOT NULL constraint violation on the email field."

Made with passive-aggressive love by manoga.digital. Powered by Claude.