SQL - Table RelationshipsWhich SQL constraint is commonly used to enforce a one-to-one relationship between two tables?AFOREIGN KEY without UNIQUEBCHECK constraint on any columnCUNIQUE constraint on the foreign key columnDNOT NULL constraint on primary keyCheck Answer
Step-by-Step SolutionSolution:Step 1: Identify constraint enforcing uniquenessTo ensure one-to-one, the foreign key must be unique so no duplicates link to the same row.Step 2: Match constraints to this needUNIQUE constraint on the foreign key column enforces this, while FOREIGN KEY alone does not guarantee uniqueness.Final Answer:UNIQUE constraint on the foreign key column -> Option CQuick Check:Unique foreign key = one-to-one [OK]Quick Trick: Use UNIQUE on foreign key to enforce one-to-one [OK]Common Mistakes:MISTAKESUsing FOREIGN KEY without UNIQUE allows many-to-oneConfusing CHECK with uniquenessAssuming NOT NULL enforces one-to-one
Master "Table Relationships" in SQL9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More SQL Quizzes Advanced Joins - Join order and performance impact - Quiz 11easy Aggregate Functions - COUNT(*) vs COUNT(column) difference - Quiz 9hard Aggregate Functions - Why aggregation is needed - Quiz 11easy GROUP BY and HAVING - HAVING clause for filtering groups - Quiz 3easy INNER JOIN - INNER JOIN syntax - Quiz 12easy LEFT and RIGHT JOIN - LEFT JOIN execution behavior - Quiz 3easy Set Operations - EXCEPT (MINUS) for differences - Quiz 10hard Table Constraints - Foreign key ON DELETE behavior - Quiz 15hard Table Constraints - FOREIGN KEY constraint - Quiz 11easy Table Constraints - Constraint naming conventions - Quiz 9hard