SQL - Table RelationshipsIn a one-to-one relationship between two tables, what is the best way to enforce uniqueness on the related table?AUse a NOT NULL constraint on the foreign key columnBUse a CHECK constraint on the foreign key columnCUse a UNIQUE constraint on the foreign key columnDUse a DEFAULT constraint on the foreign key columnCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand uniqueness enforcement in one-to-one relationshipsOne-to-one relationships require that each foreign key value appears only once in the related table.Step 2: Identify the correct constraint for uniquenessA UNIQUE constraint ensures that no duplicate values exist in the foreign key column, enforcing one-to-one mapping.Final Answer:Use a UNIQUE constraint on the foreign key column -> Option CQuick Check:Uniqueness enforcement = UNIQUE constraint [OK]Quick Trick: Use UNIQUE constraint on foreign key for one-to-one [OK]Common Mistakes:MISTAKESConfusing CHECK with UNIQUE constraintUsing NOT NULL alone without uniquenessAssuming DEFAULT enforces uniqueness
Master "Table Relationships" in SQL9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More SQL Quizzes Aggregate Functions - Why aggregation is needed - Quiz 5medium INNER JOIN - INNER JOIN with multiple conditions - Quiz 3easy LEFT and RIGHT JOIN - Finding unmatched rows with LEFT JOIN - Quiz 8hard Set Operations - UNION ALL with duplicates - Quiz 4medium Set Operations - Set operations with ORDER BY - Quiz 9hard Table Constraints - Foreign key ON DELETE behavior - Quiz 7medium Table Constraints - NOT NULL constraint - Quiz 7medium Table Constraints - Foreign key ON UPDATE behavior - Quiz 7medium Table Constraints - FOREIGN KEY constraint - Quiz 5medium Table Relationships - Many-to-many with junction tables - Quiz 5medium