Wednesday, March 7, 2012

Question about Aliasing?

Heya,

While reading about aliasing using two different references, one author states that the aliasing is annotated using the key AS like in:
select...
FROM Emp as E1;

but in the other reference, the author states the key AS is not necessary, so the above query can be written instead as follows:
select...
FROM Emp E1

i am just wondering which one is correct? what MySQL/Oracle supports?

Many thankswhich one is correct depends on which database you're using

off the top of my head i can't remember which one requires AS (as opposed to it being optional)

besides, the sql reads better with AS, so i always throw it in, consequently i never get the syntax error when it's missing

helps?|||It works either way in Oracle or SQL Server. I'm not sure about mySQL. You're always safe using AS.

No comments:

Post a Comment