Baidu AI Cloud
中国站

百度智能云

Data Warehouse

Alias

When you write the name of lists, columns, or expressions that contain columns in a query, you can assign them an alias at the same time. Whenv using the list and column names, you can use their aliases to access them. Aliases are usually shorter and easier to remember than their original names. When required to create an alias, just add the AS alias clause after the name of the list, column or expression in the select list or the from list. The AS keyword is optional. The user can specify an alias directly after the original name. If the alias or other identifier has the same name as the internal keyword, you need to add the `` symbol to the name. Aliases are case sensitive.

Example:

 mysql> select tiny_column as name, int_column as sex from big_table;
 mysql> select sum(tiny_column) as total_count from big_table;
 mysql> select one.tiny_column, two.int_column from small_table one, big_table two \
     -> where one.tiny_column = two.tiny_column;
Previous
Syntactical Help
Next
Comments