Skip to content
Official PYQ · 2005

GATE CS 2005 Q75 — ER-model

Explain with AI

Let E1E_1 and E2E_2 be two entities in an E/RE/R diagram with simple-valued attributes. R1R_1 and R2R_2 are two relationships between E1E_1 and E2E_2, where R1R_1 is one-to-many and R2R_2 is many-to-many. R1R_1 and R2R_2 do not have any attributes of their own. What is the minimum number of tables required to represent this situation in the relational model?

Choose one option
View worked solution

Answer: B

To find the minimum number of tables required to represent the given E/R diagram in the relational model, we analyze each component step-by-step:

  1. Entities E1E_1 and E2E_2: Each entity with simple-valued attributes generally requires its own table to store its attributes.
    • Let the table for E1E_1 have primary key K1K_1.
    • Let the table for E2E_2 have primary key K2K_2.
  2. One-to-Many Relationship R1R_1: In a 1:N1:N (one-to-many) relationship, we do not need a separate table. Instead, we can merge the relationship into the table of the entity on the "many" (NN) side by adding the primary key of the "one" side entity as a foreign key.
    • For example, if the relationship is 1:N1:N from E1E_1 to E2E_2, we can represent R1R_1 by adding K1K_1 as a foreign key in the table for E2E_2.
    • Thus, E1E_1, E2E_2, and R1R_1 can be represented using just 2 tables:
      • Table E1(K1,… )\text{Table } E_1(K_1, \dots)
      • Table E2(K2,…,K1)\text{Table } E_2(K_2, \dots, K_1)
  3. Many-to-Many Relationship R2R_2: An M:NM:N (many-to-many) relationship cannot be merged into either of the entity tables without causing redundancy or violating normalization rules. Therefore, it always requires a separate table containing the primary keys of both participating entities as foreign keys.
    • Table R2(K1,K2)\text{Table } R_2(K_1, K_2)

Combining these, the minimum number of tables required is:

Total Tables=2 (for E1,E2, and R1)⏟Merged+1 (for R2)⏟Separate=3\text{Total Tables} = \underbrace{2 \text{ (for } E_1, E_2, \text{ and } R_1\text{)}}_{\text{Merged}} + \underbrace{1 \text{ (for } R_2\text{)}}_{\text{Separate}} = 3

Hence, the minimum number of tables required is 3.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore ER-model questions