Skip to content
Official PYQ · 2015

GATE CS 2015 Set 1 Q41 — ER-model

Explain with AI
Consider an Entity-Relationship (ER)(\text{ER}) model in which entity sets E1E_{1} and E2E_{2} are connected by an m:nm:n relationship R12R_{12}. E1E_{1} and E3E_{3} are connected by a 1:n1 : n (11 on the side of E1E_{1} and nn on the side of E3E_{3}) relationship R13R_{13}.

E1E_{1} has two-singled attributes a11a_{11} and a12a_{12} of which a11a_{11} is the key attribute. E2E_{2} has two singled-valued attributes a21a_{21} and a22a_{22} of which a21a_{21} is the key attribute. E3E_{3} has two single-valued attributes a31a_{31} and a32a_{32} of which a31a_{31} is the key attribute. The relationships do not have any attributes.

If a relational model is derived from the above ER\text{ER} model, then the minimum number of relations that would be generated if all relation are in 3NF\text{3NF} is________________.
View worked solution

Answer: 4

To find the minimum number of relations in 3NF, we analyze the entities and their relationships step-by-step:

1. Entity Sets

  • E1E_1 has attributes: {a11,a12}\{a_{11}, a_{12}\} with primary key a11a_{11}.
  • E2E_2 has attributes: {a21,a22}\{a_{21}, a_{22}\} with primary key a21a_{21}.
  • E3E_3 has attributes: {a31,a32}\{a_{31}, a_{32}\} with primary key a31a_{31}.

2. Many-to-Many (m:nm:n) Relationship R12R_{12}

For an m:nm:n relationship between E1E_1 and E2E_2, we cannot merge the relationship into either entity relation without causing redundancy and violating 2NF/3NF. Thus, we must create a separate relation for R12R_{12}:

R12(a11,a21‾)R_{12}(\underline{a_{11}, a_{21}})

Where a11a_{11} and a21a_{21} are foreign keys referencing E1E_1 and E2E_2 respectively.

3. One-to-Many (1:n1:n) Relationship R13R_{13}

For a 1:n1:n relationship where E1E_1 is on the 11-side and E3E_3 is on the nn-side, we can merge the relationship into the relation of the nn-side entity (E3E_3) by adding the primary key of E1E_1 as a foreign key. This avoids creating an extra relation and keeps the schema in 3NF:

E3(a31‾,a32,a11)E_3(\underline{a_{31}}, a_{32}, a_{11})

Here, the functional dependencies are a31→a32a_{31} \rightarrow a_{32} and a31→a11a_{31} \rightarrow a_{11}. Since the determinant a31a_{31} is a candidate key, this relation is in 3NF.

4. Final Set of Relations

The minimum set of relations required is:

  1. E1(a11‾,a12)E_1(\underline{a_{11}}, a_{12})
  2. E2(a21‾,a22)E_2(\underline{a_{21}}, a_{22})
  3. E3(a31‾,a32,a11)E_3(\underline{a_{31}}, a_{32}, a_{11})
  4. R12(a11,a21‾)R_{12}(\underline{a_{11}, a_{21}})

Thus, the minimum number of relations is 4.

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

Published
Report a correction
Keep exploringMore ER-model questions