Why would you use "AS" when aliasing a SQL table?

Posted by froadie on Stack Overflow See other posts from Stack Overflow or by froadie
Published on 2010-03-16T14:06:53Z Indexed on 2010/03/16 14:16 UTC
Read the original article Hit count: 379

Filed under:
|
|
|

I just came across a SQL statement that uses AS to alias tables, like this:

SELECT all, my, stuff
FROM someTableName AS a
INNER JOIN someOtherTableName AS b
    ON a.id = b.id

What I'm used to seeing is:

SELECT all, my, stuff
FROM someTableName a
INNER JOIN someOtherTableName b
    ON a.id = b.id

I'm assuming there's no difference and it's just syntactic sugar, but which of these is more prevalent/wide-spread? Is there any reason to prefer one over the other?

© Stack Overflow or respective owner

Related posts about sql

Related posts about syntax