Bird
0
0

Which SQL constraint is commonly used to enforce a one-to-one relationship between two tables?

easy📝 Syntax Q12 of 15
SQL - Table Relationships
Which SQL constraint is commonly used to enforce a one-to-one relationship between two tables?
AFOREIGN KEY without UNIQUE
BCHECK constraint on any column
CUNIQUE constraint on the foreign key column
DNOT NULL constraint on primary key
Step-by-Step Solution
Solution:
  1. Step 1: Identify constraint enforcing uniqueness

    To ensure one-to-one, the foreign key must be unique so no duplicates link to the same row.
  2. Step 2: Match constraints to this need

    UNIQUE constraint on the foreign key column enforces this, while FOREIGN KEY alone does not guarantee uniqueness.
  3. Final Answer:

    UNIQUE constraint on the foreign key column -> Option C
  4. Quick Check:

    Unique foreign key = one-to-one [OK]
Quick Trick: Use UNIQUE on foreign key to enforce one-to-one [OK]
Common Mistakes:
MISTAKES
  • Using FOREIGN KEY without UNIQUE allows many-to-one
  • Confusing CHECK with uniqueness
  • Assuming NOT NULL enforces one-to-one

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes