How To Define and Use Table Alias Names

Q

How To Define and Use Table Alias Names? - MySQL FAQs - SQL SELECT Statements with JOIN and Subqueries

✍: FYIcenter.com

A

When column names need to be prefixed with table names, you can define table alias name and use them to prefix column names as shown in the following select statement:

mysql> SELECT l.id, l.url, r.comment FROM fyi_links l 
   INNER JOIN fyi_rates r ON l.id = r.id;
+-----+-------------------+-----------+
| id  | url               | comment   |
+-----+-------------------+-----------+
| 101 | dev.fyicenter.com | The best  |
| 102 | dba.fyicenter.com | Well done |
| 103 | sqa.fyicenter.com | Thumbs up |
+-----+-------------------+-----------+
3 rows in set (0.00 sec)

2007-05-11, 4875👍, 0💬