Consider the following relation schema pertaining to a students database:…

2004

Consider the following relation schema pertaining to a students database:

  • Student (rollno, name, address)

  • Enroll (rollno, courseno, coursename)

where the primary keys are shown underlined. The number of tuples in the Student and Enroll tables are 120 and 8 respectively. What are the maximum and minimum number of tuples that can be present in (Student * Enroll), where '*' denotes natural join ?

  1. A.

    8, 8

  2. B.

    120, 8

  3. C.

    960, 8

  4. D.

    960, 120

Attempted by 87 students.

Show answer & explanation

Correct answer: A

Final answer: 8, 8

Key assumption: enroll.rollno refers to student.rollno (i.e., Enroll.rollno is a foreign key referencing Student.rollno).

  • Maximum: Because student.rollno is a primary key, at most one Student tuple has a given rollno. Each Enroll tuple contains exactly one rollno, so it can join with at most one Student tuple. Therefore the natural join can produce at most as many tuples as Enroll, which is 8.

  • Minimum: Under the foreign-key assumption every Enroll tuple must match a Student tuple, so the join will always produce 8 tuples; hence minimum = maximum = 8. If referential integrity is not assumed, the minimum could be 0 (when no rollno values overlap).

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir