MySQL Tutorial – Using Column Aliases

Column Aliases

To rename a column in database table, use the AS keyword it allows you to alias the name to different value.

The syntax of AS keyword:

SELECT column_name(s)AS alias_name FROM table_name

AS keyword example:

SELECT f_name AS Firstname FROM employee_record;

[TABLE=3]

It will display all the f_name of employee and the header is Firstname.

Result:

+------------+
| Firstname  |
+------------+
| Piolo      |
| Sam        |
| John Lloyd |
| Rolan      |
| Jericho    |
| John       |
+------------+
6 rows in set (0.00 sec)
, , , ,

Post navigation

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.