SQL - Table RelationshipsWhy is it important to use a composite primary key in a junction table instead of a single surrogate key?AComposite keys make queries run faster in all cases.BSurrogate keys are not allowed in junction tables by SQL standards.CComposite keys prevent duplicate pairs and enforce relationship uniqueness.DSurrogate keys cause data loss in many-to-many relationships.Check Answer
Step-by-Step SolutionSolution:Step 1: Understand uniqueness in junction tablesEach pair of foreign keys must be unique to represent a valid relationship.Step 2: Role of composite primary keyComposite primary key enforces uniqueness of pairs, preventing duplicates.Final Answer:Composite keys prevent duplicate pairs and enforce relationship uniqueness. -> Option CQuick Check:Composite key = uniqueness enforcement [OK]Quick Trick: Composite keys ensure unique pairs in junction tables [OK]Common Mistakes:MISTAKESBelieving surrogate keys are disallowedThinking composite keys always improve speedAssuming surrogate keys cause data loss
Master "Table Relationships" in SQL9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More SQL Quizzes GROUP BY and HAVING - Why grouping is needed - Quiz 1easy INNER JOIN - INNER JOIN with table aliases - Quiz 7medium LEFT and RIGHT JOIN - Multiple LEFT JOINs in one query - Quiz 5medium LEFT and RIGHT JOIN - Finding unmatched rows with LEFT JOIN - Quiz 11easy Set Operations - Why set operations are needed - Quiz 5medium Subqueries - Subquery in FROM clause (derived table) - Quiz 9hard Subqueries - Subquery vs JOIN performance trade-off - Quiz 12easy Table Constraints - Foreign key ON DELETE behavior - Quiz 13medium Views - Querying through views - Quiz 12easy Views - Querying through views - Quiz 15hard