If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > SQL - Renaming Columns

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-29-07, 12:59
compsci compsci is offline
Registered User
 
Join Date: Jun 2007
Location: London
Posts: 117
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
Reply With Quote
  #2 (permalink)  
Old 11-30-07, 06:13
aschk aschk is offline
Registered User
 
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).
Reply With Quote
  #3 (permalink)  
Old 11-30-07, 21:29
compsci compsci is offline
Registered User
 
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!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On