When we do a query such as this
SELECT COUNT(*)
FROM A, B, C
WHERE A.type = B.type
AND B.cost = C.cost
What can we say about the result table? What will the size of the result table be?
If A has 5 rows, B has 8 rows, and C has 7 rows
EDIT: Can I please get some response instead of mark down? I am total new to SQL and need help.
EDIT2: What I am trying to do – Understand how WHERE and AND clause works & why the result table has 8 rows
How you came to this particular question – I was reading my textbook and doing the questions in it
What I’ve tried to solve it – I tried Google and reading various of posts but most of them just shows HOW to do it instead of explaining what’s actually happpening
The count will be the number of common values . E.g. Consider this small example
The result is 5. Because
a.Val1 = b.Val2has 5 common elements viz 1,2 3,4,5. Nowb.Val2 = c.Val3has 6 common elements viz 1,2,3,4,5,6.Then these two result sets will act upon each other and will try to get the intersecting values i.e. common values which is again 1,2,3,4,5. Hence is the count as 5