CS FundamentalsEasyWipro · Cognizant pattern

A table has a UNIQUE constraint on (email) and a separate UNIQUE constraint on (phone). An application inserts a row where email already exists but phone is new. What happens?

  1. A. Only the phone column is inserted, with email set to NULL
  2. B. The insert succeeds, since only ONE of the two unique constraints is violated
  3. C. The insert fails, because EITHER unique constraint being violated is enough to reject the row
  4. D. The database automatically updates the existing row instead (upsert) without being told to

Correct answer: C. The insert fails, because EITHER unique constraint being violated is enough to reject the row

Each UNIQUE constraint independently blocks duplicates in its own column(s); a row violating ANY ONE of multiple independent constraints is rejected outright. Only an explicit UPSERT-style statement (e.g. INSERT ... ON CONFLICT) would change this default all-or-nothing rejection behaviour.

More DBMS and SQL questions

Exams that ask this topic