Joins vs .notation?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
arpowers
Forum Commoner
Posts: 76
Joined: Sun Oct 14, 2007 10:05 pm
Location: san diego, ca

Joins vs .notation?

Post 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
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Moved to Databases.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Joins vs .notation?

Post 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/
Post Reply