The GATE Grind

GATE 2025 DA – Question 62

Database Management and Warehousing · Relational algebra, tuple calculus and SQL · 2 marks · Numerical answer

Consider the following tables, Loan and Borrower, of a bank.

Loan: loan numbranch nameamount
L11Banjara Hills90000
L14Kondapur50000
L15SR Nagar40000
L22SR Nagar25000
L23Balanagar80000
L25Kondapur70000
L19SR Nagar65000
Borrower: customer nameloan num
AnandL11
KarteekL11
KarteekL14
AnkitaL15
GopalL19
KarteekL22
KarteekL23
SunilL23
SunilL25

Query: $\pi_{branch\ name, customer\ name}(Loan \bowtie Borrower) \div \pi_{branch\ name}(Loan)$

where $\bowtie$ denotes natural join.

The number of tuples returned by the above relational algebra query is ______ (*Answer in integer*)

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: 1

Explanation

The division returns the customers that are paired with every branch in the second relation. The branches are Banjara Hills, Kondapur, SR Nagar and Balanagar (4 of them). Joining Loan and Borrower pairs each customer with the branches of their loans: Anand with Banjara Hills; Karteek with Banjara Hills (L11), Kondapur (L14), SR Nagar (L22) and Balanagar (L23), which is all 4; Ankita and Gopal with SR Nagar only; Sunil with Balanagar and Kondapur. Only Karteek is paired with all the branches, so 1 tuple is returned.