Question

Consider an Entity-Relationship (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 single-valued attributes a11a_{11} and a12a_{12} of which a11a_{11} is the key attribute. E2E_2 has two single-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 model, then the minimum number of relations that would be generated if all the relations are in 3NF is _____.

Official answer and solution
Official answer
4
From
Official GATE 2015 answer key

Solution

Determine the minimal relational schema in 3NF by representing entity sets and relationships according to their mapping cardinalities.

  1. Entity Sets:

    • E1(a11,a12)E_1(a_{11}, a_{12}) requires a table with primary key a11a_{11}.
    • E2(a21,a22)E_2(a_{21}, a_{22}) requires a table with primary key a21a_{21}.
    • E3(a31,a32)E_3(a_{31}, a_{32}) requires a table with primary key a31a_{31}.
  2. Relationship R12R_{12} (m:nm:n between E1E_1 and E2E_2):

    • A many-to-many relationship cannot be combined into either entity table without introducing non-atomic attributes or redundancy.
    • Hence, R12R_{12} requires its own table: R12(a11,a21‾)R_{12}(\underline{a_{11}, a_{21}}) with composite primary key (a11,a21)(a_{11}, a_{21}).
  3. Relationship R13R_{13} (1:n1:n between E1E_1 and E3E_3):

    • The relationship is 11 on E1E_1 and nn on E3E_3. Each entity in E3E_3 is associated with at most one entity in E1E_1.
    • Thus, the primary key of E1E_1 (a11a_{11}) can be placed as a foreign key inside the table for E3E_3 without violating 3NF:
      E3(a31‾,a32,a11).E_3(\underline{a_{31}}, a_{32}, a_{11}).
    • This eliminates the need for a separate table for R13R_{13}.
  4. Total Relations:
    The resulting tables are:

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

All four relations are in 3NF, so the minimum number of relations is 44.

Final answer

4

Common trap

Creating a separate fifth table for the 1:n relationship R13 instead of embedding the foreign key inside entity set E3.

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2015 Computer Science and Information Technology (CS) Session 1
Question
51 of 65, printed as CS Q.41
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.