Updated on 2026-11-06 GMT+08:00
Column Alias
Function
Assigns an alias to a column.
Syntax
SELECT attr_expr [AS] alias, attr_expr [AS] alias, ... FROM table_reference;
Keywords
- alias: Used to assign an alias to a field name in attr_expr.
- AS: Whether this keyword is added does not affect the 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.
Example
First, obtain a result through a subquery SELECT name AS n FROM simple_table WHERE score > 90. The alias n assigned to name in the subquery can be directly used in the outer SELECT statement.
SELECT n FROM (SELECT name AS n FROM simple_table WHERE score > 90) m WHERE n = "xiaoming";
Parent topic: Alias
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