edited by
12,597 views
37 votes
37 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
);
  1. $3$
  2. $9$
  3. $5$
  4. $6$
edited by

1 Answer

Best answer
47 votes
47 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.$
edited by
Answer:

Related questions

40 votes
40 votes
6 answers
2
53 votes
53 votes
4 answers
3