Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2007
    Location
    London
    Posts
    117

    Unanswered: SQL - Renaming Columns

    Hello all,

    I have just come across this; renaming columns. Here is some SQL:

    SELECT teamname As Team FROM Team WHERE goaldifference >15

    Isn' the above the same as:

    SELECT teamname FROM Team WHERE goaldifference > 15

    What is the purpose of As

    Thanks for any help

  2. #2
    Join Date
    Mar 2007
    Location
    636f6d7075746572
    Posts
    770
    That's a column alias, so if you put this through MySQL command line you will see the COLUMN for teamname is called "Team" and NOT "teamname" any longer.
    If you want a table alias then use the same (after the table name).

  3. #3
    Join Date
    Jun 2007
    Location
    London
    Posts
    117
    Quote Originally Posted by aschk
    That's a column alias, so if you put this through MySQL command line you will see the COLUMN for teamname is called "Team" and NOT "teamname" any longer.
    If you want a table alias then use the same (after the table name).
    Thanks for your help!

    I can use SQL practically, but i am clearly missing a lot of theory!

Posting Permissions

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