Question:

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


Query: \[ \pi_{\text{branch\_name}, \text{customer\_name}} (\text{Loan} \bowtie \text{Borrower}) \div \pi_{\text{branch\_name}}(\text{Loan}) \] where \( \bowtie \) denotes natural join. The number of tuples returned by the above relational algebra query is 1 (Answer in integer).

Show Hint

Relational division \( R \div S \) returns all tuples from \( R \) that are associated with all tuples in \( S \). This is useful for queries involving "for all" conditions.
Updated On: Apr 4, 2025
Hide Solution
collegedunia
Verified By Collegedunia

Solution and Explanation

Step 1: Understanding the division operation. 
The relational division operation finds the set of customers who have taken loans from all branches appearing in the Loan table. 

Step 2: Extracting relevant data. 
The distinct branch names from the Loan table are: Banjara Hills, Kondapur, SR Nagar, Balanagar. A customer must have taken loans from all these branches to be included in the result. 

Step 3: Identifying customers who satisfy this condition. 
By analyzing the Borrower table, we find that the customer Karteek has loans in Banjara Hills (L11), Kondapur (L14), SR Nagar (L22), and Balanagar (L23), satisfying the condition. 

Thus, the number of tuples returned by the query is: 1 

Was this answer helpful?
0
0

Questions Asked in GATE DA exam

View More Questions