• edited by
19,770 views
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
);
  1. $3$
  2. $9$
  3. $5$
  4. $6$

2 Answers

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.$
• edited by
Answer:
Position:
Show:

Related questions

75 75 votes
4 answers 4 answers
24.7k
24.7k views
go_editor asked Sep 29, 2014
24,681 views
On a non-pipelined sequential processor, a program segment, which is the part of the interrupt service routine, is given to transfer $500$ bytes from an I/O device to mem...
59 59 votes
6 answers 6 answers
20.3k
20.3k views
go_editor asked Sep 29, 2014
20,271 views
Consider a database table T containing two columns $\text{X}$ and $\text{Y}$ each of type $\text{integer}$. After the creation of the table, one record $\text{(X=1, Y=1)}...
63 63 votes
6 answers 6 answers
18.5k
18.5k views
go_editor asked Sep 29, 2014
18,535 views
Consider a relational table $r$ with sufficient number of records, having attributes $A_1, A_2, \dots ,A_n$ and let $1 \leq p \leq n$. Two queries $Q1$ and $Q2$ are given...
92 92 votes
7 answers 7 answers
29.8k
29.8k views
go_editor asked Sep 29, 2014
29,808 views
Consider a relational table with a single record for each registered student with the following attributes:$\text {Registration_Num:}$ Unique registration number for each...