I came across the following SQL statement and I was wondering if it was valid:
SELECT COUNT(*)
FROM
registration_waitinglist,
registration_registrationprofile
WHERE
registration_registrationprofile.activation_key = "ALREADY_ACTIVATED"
What does the two tables separated by a comma mean?
When you
SELECTdata from multiple tables you obtain theCartesian Productof all the tuples from these tables. It can be illustrated in the following way:This means you get each row from the first table paired with all the rows from the second table. Most of the time, it is not what you want. If you really want it, then it’s clearer to use the
CROSS JOINnotation: