Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2004
    Posts
    3

    Exclamation Unanswered: 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 thanks

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    which 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?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Apr 2004
    Location
    Kansas City, MO
    Posts
    734
    It works either way in Oracle or SQL Server. I'm not sure about mySQL. You're always safe using AS.
    MeanOldDBA
    derrickleggett@hotmail.com
    When life gives you a lemon, fire the DBA.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •