Quote:
|
I'm curious if there're any performance differences between the one you gave above and the one I've originally using AND
|
performance differences? probably
but more significant is the difference in results
your original query used inner joins, whereas roga's used left joins!!
the results would be the same only if there happened to be no unmatched rows
also, while the mysql manual is not very clear about this, a NATURAL join in standard sql does not have a USING clause, rather, it joins tables based on
all identically named columns
so the original query re-written with NATURAL joins would be
SELECT *
FROM logins
NATURAL JOIN profiles
NATURAL JOIN avatars
NATURAL JOIN prefs
NATURAL JOIN groups
NATURAL JOIN tmpl
WHERE username='john'
if you use the convention of naming an auto_increment column as "id" and a relationship column as "some_id" then both tables would have an "id" column and the NATURAL join would try to join based on the that, which would of course be incorrect