Let E1 and E2 be two entities in an ER diagram with simple-valued attributes. R1 and R2 are two relationships between E1 and E2, where R1 is one-to-many and R2 is many-to-many. R1 and R2 do not have any attributes of their own. What is the minimum number of tables required to represent this situation in the relational model? A. 2 B. 3 C. 4 D. 5
GATE 2005 · Databases · ER Diagram · medium
Answer: 3 tables (B)
- Tables for entities: E1 -> Table_E1, E2 -> Table_E2. This gives 2 tables.
- Table for R1 (one-to-many): R1 is one-to-many from E1 to E2. We add the primary key of E1 as a foreign key in Table_E2. No additional table is needed for R1.
- Table for R2 (many-to-many): R2 is many-to-many. It cannot be absorbed into either entity table. A separate junction table Table_R2(E1_key, E2_key) is required. This adds 1 more table.
- Count total tables: Total = 2 (entities) + 0 (R1 merged) + 1 (R2 junction) = 3 tables.