NOT NULL Constraint

noun

say it: “NOT NUL kun-STRAYNT” /nɒt nʌl kənˈstreɪnt/

A rule on a column that it must always have a value.

What does NOT NULL Constraint do in a relational database?

NOT NULL Constraint — A constraint requiring a column to contain a non-NULL value.

CREATE TABLE customer (
    customer_id INTEGER PRIMARY KEY,
    email CHARACTER VARYING(255) NOT NULL,
    status CHARACTER VARYING(20) DEFAULT 'active'
);

In a sentence

  • “ProductName has a NOT NULL constraint, so every product must have a name.”

Level: Novice · More SQL terms at this level

Updated