[thelist] new & improved SQL join syntax?

Marianela Queme mqueme at gmail.com
Fri Jan 19 08:23:28 CST 2007


Hi Sarah:

>From what I've hear, (I'm not a db expert but lots of my coworkers are) the
simple query where it lists all tables separated by commas, translates to an
inner join as seen in your example.  But for simple left outer joins the
comma separated query would translate to a more complex query which will
outcome in a less optimal one.  I would say that sql has its tools for
making these complex query's  into simple ones which will improve
performance.  I would also appreciate an easy to understand tutorial if
anyone can suggest one.

>
>       SELECT a.foo, a.field1, b.qux, b.field2
>         FROM table1 as a, table2 as b
>        WHERE a.field1 = b.field2
>
> and should be replaced with:
>
>       SELECT a.foo, a.field1, b.qux, b.field2
>         FROM table1 as a
>   INNER JOIN table2 as b
>           ON a.field1 = b.field2
>
> Has anyone else heard this, and can they shed any light on it? I guess
> I'm just wondering where this change came from, how important it is, do
> I need to go back and re-work countless queries to use this syntax, etc?
>
> Also, if anyone has an easy-to-understand tutorial on JOIN clauses
> (especially LEFT JOIN and the like), I'd really appreciate it - it's one
> of those things that I understand but couldn't for the life of me
> explain to someone else :)
>

-- 
Marianela Queme
Guatemala
"Life is beautiful"



More information about the thelist mailing list