GATE 2025 DA – Question 62
Consider the following tables, Loan and Borrower, of a bank.
| Loan: loan num | branch name | amount |
|---|---|---|
| L11 | Banjara Hills | 90000 |
| L14 | Kondapur | 50000 |
| L15 | SR Nagar | 40000 |
| L22 | SR Nagar | 25000 |
| L23 | Balanagar | 80000 |
| L25 | Kondapur | 70000 |
| L19 | SR Nagar | 65000 |
| Borrower: customer name | loan num |
|---|---|
| Anand | L11 |
| Karteek | L11 |
| Karteek | L14 |
| Ankita | L15 |
| Gopal | L19 |
| Karteek | L22 |
| Karteek | L23 |
| Sunil | L23 |
| Sunil | L25 |
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.