mysql aliases

mysql aliases are used to rename a table or a column heading.

mysql alias syntax for tables

         select     column_name(s)

         from    table_name     as  alias_name;

the alias for the table is called table the syntax as keyword is optional so you can omit it.

mysql alias syntax for columns

         select     column_name(s)      as  alias_name

         from    table_name; 

you can also give an expression an alias.

you can use the column alias in the order by, group by and having clauses to refer to the column.

you can't use column alias in the where clause.

MySQL Aliase example

                select   o.firstname  from  user  as  o
                order by   o.firstname;