Assume that each customers has Rs.$100$ in their bank account account and there are only $5$ customers.
Customer |
balance |
C1 |
100 |
C2 |
100 |
C3 |
100 |
C4 |
100 |
C5 |
100 |
Consider query 1.
from account A, account B \\ This line will do cross-product of the table with itself i.e. we will get 5*5 = 25 tuples
where A.balance <= B.balance \\ All of the 25 tuples will satisfy this equation as every balance = 100 i.e. same
group by A.customer \\ this will make group of tuples where each tuple's A.customer has same name i.e there will be 5 groups {C1} ,{C2},{C3},{C4],{C5} and each will have 5 tuples
Group |
A.Customer |
A.Balance |
B.Customer |
B.balance |
group 1 |
C1 |
100 |
C1 |
100 |
C1 |
100 |
C2 |
100 |
C1 |
100 |
C3 |
100 |
C1 |
100 |
C4 |
100 |
C1 |
100 |
C5 |
100 |
group 2 |
C2 |
100 |
C1 |
100 |
C2 |
100 |
C2 |
100 |
C2 |
100 |
C3 |
100 |
C2 |
100 |
C4 |
100 |
C2 |
100 |
C5 |
100 |
group 3 |
C3 |
100 |
C1 |
100 |
C3 |
100 |
C2 |
100 |
C3 |
100 |
C3 |
100 |
C3 |
100 |
C4 |
100 |
C3 |
100 |
C5 |
100 |
group 4 |
C4 |
100 |
C1 |
100 |
C4 |
100 |
C2 |
100 |
C4 |
100 |
C3 |
100 |
C4 |
100 |
C4 |
100 |
C4 |
100 |
C5 |
100 |
group 5 |
C5 |
100 |
C1 |
100 |
C5 |
100 |
C2 |
100 |
C5 |
100 |
C3 |
100 |
C5 |
100 |
C4 |
100 |
C5 |
100 |
C5 |
100 |
select A.customer, count(B.customer) \\ now this will run and we will get 5 tuples as output.
A.Customer |
count (B.customer) |
C1 |
5 |
C2 |
5 |
C3 |
5 |
C4 |
5 |
C5 |
5 |
But according to question instead of $5$ we should have got $1$ as output for each tuple.
$\therefore$ query1 is giving wrong output.
Consider query 2.
from account A, account B \\ This line will do cross-product of the table with itself i.e. we will get 5*5 = 25 tuples
where A.balance < B.balance \\ none of the 25 tuples will satisfy this equation as every balance = 100
so we will get empty set as output and so nothing will be printed as output.
So both query 1 and query 2 are giving incorrect result.
$\implies$ statement $4$ is correct
Since statement $4$ is present only in option $C$
$\therefore$ Option $C$ is the correct choice.