Consider a relation table (Balance,Customer) with the following records:
Now I tried these two queries here:
-- Query 1:
select A.Customer, count(B.Customer)
from account A, account B
where A.balance < B.balance
group by A.Customer;
-- Query 2:
select A.Customer, count(B.Customer)
from account A, account B
where A.balance < B.balance;
The first query gives me no output. With the second query, I am getting an output with count = 0.
In both cases there are no rows satisfying the criteria in the where clause, and hence no rows are returned. Then why is the count function giving an output only in the second case?
