GATE 2011 CS (CS1) – Question 56
Loan_Records(Borrower,Bank_Manager,Loan_Amount) contains (Ramesh,Sunderajan,10000),(Suresh,Ramgopal,5000),(Mahesh,Sunderajan,7000). Find the output.
SELECT count(*)
FROM (SELECT Borrower,Bank_Manager FROM Loan_Records) AS S
NATURAL JOIN
(SELECT Bank_Manager,Loan_Amount FROM Loan_Records) AS T;Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (C) 5
Explanation
The natural join matches the shared Bank_Manager attribute. Sunderajan has two rows on each side, contributing 2×2=4 joined rows. Ramgopal has one on each, contributing one. Total count is five, C; joining the separate projections does not restore only the original borrower/amount pairing.
More Relational Model: Relational Algebra, Tuple Calculus, SQL questions
- GATE 2010 CS (CS1) Q29
- GATE 2010 CS (CS1) Q53
- GATE 2015 CS (CS2) Q40
- GATE 2015 CS (CS3) Q29
- GATE 2021 CS (CS2) Q41
- GATE 2026 CS (CS1) Q30
All Relational Model: Relational Algebra, Tuple Calculus, SQL questions →