[Solved] Tuple variables – Can someone explain to me the following SQL statement


Considering you’re only selecting the address, those selects are equivalent. It returns two addresses because there are two “Johns”.

Joining on address would allow you to figure you who else lives with John. For example:

SELECT c2.first_name
FROM users c1, users c2
WHERE c1.address = c2.address
AND c1.first_name="John"
AND c2.first_name != 'John'

would tell you the names of everybody who lives with a “John”.

4

solved Tuple variables – Can someone explain to me the following SQL statement