Page 1 of 1

Joins vs .notation?

Posted: Sat Oct 20, 2007 2:47 pm
by arpowers
Hey everybody,

I've been doing a project with LOT of queries and relational tables...
To this point I've pretty much been using the . query notation for this...

Code: Select all

query = 'SELECT tbl_users.id, tbl_users.name, tbl_somethingelse.something
            FROM tbl_users, tbl_somethingelse
             WHERE....' (you get the idea)
what are the tradeoffs between using this and using 'joins' (which I don't know how to use!)
thanks
Andrew

Posted: Sat Oct 20, 2007 4:45 pm
by RobertGonzalez
Moved to Databases.

Re: Joins vs .notation?

Posted: Sat Oct 20, 2007 5:48 pm
by califdon
arpowers wrote:Hey everybody,

I've been doing a project with LOT of queries and relational tables...
To this point I've pretty much been using the . query notation for this...

Code: Select all

query = 'SELECT tbl_users.id, tbl_users.name, tbl_somethingelse.something
            FROM tbl_users, tbl_somethingelse
             WHERE....' (you get the idea)
what are the tradeoffs between using this and using 'joins' (which I don't know how to use!)
thanks
Andrew
I think there may be some query optimization issues, at the margins. Generally, you can execute the same logic with either syntax. Unless you're dealing with extremely complex queries and gigantic tables, I don't think you would be able to observe any difference in execution.

JOIN syntax makes it a little easier to recognize whether a join is a left, right, inner, outer or equi-join.

Joins are not at all difficult to learn. Take a look at these references:

http://en.wikipedia.org/wiki/Join_(SQL)
http://www.devshed.com/c/a/MySQL/Unders ... SQL-Joins/
http://www.microsoft.com/technet/techne ... sSQLJoins/