MySQL Forums
Forum List  »  Newbie

Re: 1st letter of table name added in SELECT
Posted by: markel_mike
Date: May 01, 2005 11:14AM

In this instance the "A" is an alias (shorthand) for the table name Address.
Using aliases reduce the amount of typing required when you want to continually refer to the Address table in complex SQL statements.

Alternative syntax would be:
SELECT * from 'Address' as A

Of course, in the above statement, assigning an alias name really does no good because the Address table is only referenced one time.

It's more commonly used when multiple joins are performed like the following (from the manual):

A table reference can be aliased using tbl_name AS alias_name or tbl_name alias_name:

mysql> SELECT t1.name, t2.salary FROM employee AS t1, info AS t2
-> WHERE t1.name = t2.name;
mysql> SELECT t1.name, t2.salary FROM employee t1, info t2
-> WHERE t1.name = t2.name;

Options: ReplyQuote


Subject
Written By
Posted
Re: 1st letter of table name added in SELECT
May 01, 2005 11:14AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.