Consider the following relation schema pertaining to a students database:
- Students (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 and respectively. What are the maximum and minimum number of tuples that can be present in (Student * Enroll), where ‘*’ denotes natural join?
View worked solution
Answer: A
To find the maximum and minimum number of tuples in the natural join , let us analyze the schema and constraints:
- Common Attribute: The natural join is performed on the common attribute, which is
rollno. - Primary Key Constraint:
- In the
Studentstable,rollnois the primary key. This means everyrollnoinStudentsis unique. - In the
Enrolltable,(rollno, courseno)is the primary key. Thus,rollnocan repeat inEnroll, but each tuple represents a valid enrollment.
- In the
- Referential Integrity: In a standard database schema,
Enroll.rollnoacts as a foreign key referencingStudents.rollno. This means every student enrolled in a course must exist in theStudentstable.
Using these constraints, we can determine the size of the join:
- Since
rollnois unique inStudents, anyrollnopresent inEnrollwill match with exactly one tuple inStudents. - Since there are tuples in
Enroll, and each of these tuples matches exactly one tuple inStudents, the natural join will yield exactly tuples.
Therefore, both the maximum and minimum number of tuples in the natural join is .
Free practice · Your answers on this page are not saved.
