Updated on 2026-11-06 GMT+08:00
Table Alias
Function
Assign an alias to a table or a subquery result.
Syntax
SELECT attr_expr_list FROM table_reference [AS] alias;
Keywords
- table_reference: Can be a table, view, or subquery.
- AS: Can be used to connect table_reference and alias. Whether or not this keyword is added does not affect the command execution result.
Precautions
- The table being queried must already exist. Otherwise, an error will occur.
- The alias must be named before it is used. Otherwise, an error will occur. Additionally, you are advised to avoid duplicate names.
Examples
- Assign the alias n to the table simple_table and use n.name to access the name field in simple_table.
SELECT n.score FROM simple_table n WHERE n.name = "leilei";
- Name the result of a subquery as m and use SELECT * FROM m to return all results from the subquery.
SELECT * FROM (SELECT * FROM simple_table WHERE score > 90) AS m;
Parent topic: Table Related
What is your overall rating for this page?
0
1
2
3
4
5
6
7
8
9
10
Very dissatisfiedVery satisfied
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot