52 52 votes Database table by name $\text{Loan_Records}$ is given below. $$\begin{array}{|c|c|c|} \hline \textbf {Borrower} & \textbf {Bank_Manager} &\textbf {Loan_Amount} \\\hline \text{Ramesh }& \text{Sunderajan} & 10000.00 \\\hline \text{Suresh} & \text{Ramgopal} & 5000.00 \\\hline \text{Mahesh} & \text{Sunderajan} & 7000.00\\\hline \end{array}$$ What is the output of the following SQL query? SELECT count(*) FROM ( SELECT Borrower, Bank_Manager FROM Loan_Records) AS S NATURAL JOIN (SELECT Bank_Manager, Loan_Amount FROM Loan_Records) AS T ); $3$ $9$ $5$ $6$ Databases gatecse-2011 databases sql normal + – go_editor 19.8k views answer comment Share Follow Print See all 4 Comments 4 4 Comments reply kman30 commented Jan 23, 2019 reply Follow flag How the tables are joined in this , please somebody explain ? @Arjun sir 0 0 replyShare Raju Kalagoni commented Jan 25, 2020 reply Follow flag trick here is before applying Natural join take out the tables S & T and then we find that only one column(attribute) Bank_Manager is common for both the tables, and then as we know Natural Join will apply equality condition on common attribute of both tables, i.e., Bank_Manager, and then apply cross product, you will find best answer meaningful. 5 5 replyShare Ankur29 commented Aug 30, 2020 reply Follow flag But sir here bank_manager is common attribute then loss less decomposition not working here? Lossless and lossy working only cross product? Not in join 0 0 replyShare reboot commented Jan 16, 2021 reply Follow flag @Ankur29 for lossless decomposition, the common attribute must be a key in one of the two decomposed relations. Here it is not the case and therefore it is lossy. Also, i think Cartesian products will be lossy most of the time except few cases where the original relation itself is total order relation between the two decomposed tables. 2 2 replyShare Please log in or register to add a comment.
Best answer 67 67 votes The answer is (C). When we perform the natural join on $S$ and $T$ then result will be like this $${\begin{array}{|c|c|c|}\hline \textbf{Borrower}& \textbf{Bank_Manager}& \textbf{Loan_Amount} \\\hline \text{Ramesh}& \text{Sunderajan}& 10000.00 \\ \hline \text{Ramesh}& \text{Sunderajan}&7000.00 \\ \hline \text{Suresh}& \text{Ramgopala}& 5000.00 \\\hline \text{Mahesh}& \text{Sunderajan}& 10000.00 \\\hline \text{Mahesh}& \text{Sunderajan}& 7000.00 \\\hline \end{array}}$$ After that count (*) will count total tuples present in this table so here it is $5.$ neha pawar answered Nov 3, 2014 • edited Apr 15, 2019 by ajaysoni1924 neha pawar comment Share Follow See all 5 Comments 5 5 Comments reply Show 2 previous comments Nit9 commented Nov 29, 2015 reply Follow flag @learncp: just once as you can see in the output above 1 1 replyShare neha singh commented Sep 11, 2016 reply Follow flag No sir I have some doubt in it.How this table comes after joining.Plz elaborate it 0 0 replyShare rishabhsharma commented Jul 29, 2020 reply Follow flag Cross Product both the tables then match common attributes (here common attribute in both the tables is Bank Manager) Select only matching attributes then you will get the table as above. 0 0 replyShare Please log in or register to add a comment.
11 11 votes best answer akshay_123 answered Aug 24, 2025 akshay_123 comment Share Follow 0 reply Please log in or register to add a comment.