SQL Implicit Commands

Published 09-11-2007 5:48 PM | jokiz

Not being an SQL guy, i'm really not used to implicit commands from T-SQL.  By implicit, I mean those simplified commands which does the same thing as those documented in every SQL books. 

  1. I first encountered a query below from a teammate:

    FROM Table1 T1 JOIN Table2 ON ...

    Every book includes all those type of joins, LEFT OUTER JOIN, RIGHT OUTER JOIN, INNER JOIN AND CROSS JOIN, so my initial reaction was, wtf, what join is that.  Then I later found out that it just mean an INNER JOIN.

  2. I also encountered a comma in between tables

    FROM Table1, Table2

    And when I searched through usenet, it's just a shortcut for CROSS JOIN.

    FROM Table1 a, Table2 b WHERE a.Id = b.FkID

    on the other hand, will use an INNER JOIN

Any other implicit commands that you know of for SQL?

 

Filed under:

Comments

# jd2001 said on September 11, 2007 3:57 PM:

LEFT JOIN = LEFT OUTER JOIN

RIGHT JOIN = RIGHT OUTER JOIN

# Chomsky said on September 11, 2007 6:17 PM:

For point 2:  FROM Table1, Table2  

This is a syntax defined in SQL 92.   Oracle people are used to this form.  

It can be an inner join or an outer join depending on the where clause.  For example, you can have this:

FROM Table1 T1, Table2 T2  

Where T1.KeyID = T2.KeyID

# jokiz said on September 12, 2007 6:33 PM:

@chomsky - my teammate also told me that, smart engine.  but i do not know if it really tries either of the two joins?  i need to verify it myself, ;p.

thanks!