UNIQUE Constraint

noun

say it: “yoo-NEEK kun-STRAYNT” /juːˈniːk kənˈstreɪnt/

A rule that no two rows may have the same value in a column or set of columns.

What does UNIQUE Constraint do in a relational database?

UNIQUE Constraint — A constraint preventing duplicate values or value combinations in specified columns.

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

In a sentence

  • “A UNIQUE constraint on Email stops two members signing up with the same address.”

Level: Novice · More SQL terms at this level

Updated