Bird
0
0

Which of the following is the correct way to represent a one-to-many relationship in tables derived from an ER diagram?

easy📝 Syntax Q12 of 15
SQL - Table Relationships
Which of the following is the correct way to represent a one-to-many relationship in tables derived from an ER diagram?
ACreate a new table with only primary keys from both tables
BAdd a foreign key column in the 'many' side table referencing the 'one' side
CAdd a foreign key column in the 'one' side table referencing the 'many' side
DUse a trigger to link the two tables
Step-by-Step Solution
Solution:
  1. Step 1: Understand one-to-many relationship

    One-to-many means one record in the first table relates to many records in the second table.
  2. Step 2: Map relationship to tables

    The 'many' side table gets a foreign key column referencing the 'one' side table's primary key.
  3. Final Answer:

    Add a foreign key column in the 'many' side table referencing the 'one' side -> Option B
  4. Quick Check:

    Foreign key on 'many' side = Add a foreign key column in the 'many' side table referencing the 'one' side [OK]
Quick Trick: Foreign key goes in the 'many' side table [OK]
Common Mistakes:
MISTAKES
  • Placing foreign key on the 'one' side
  • Creating unnecessary tables for one-to-many
  • Using triggers instead of foreign keys

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes