Help Center/
Data Lake Insight/
SQL Syntax Reference (To Be Offline)/
Spark SQL Syntax Reference (Unavailable Soon)/
Alias/
AS for Column
Updated on 2024-01-23 GMT+08:00
AS for Column
Function
This statement is used to specify an alias for a column.
Syntax
1
|
SELECT attr_expr [AS] alias, attr_expr [AS] alias, ... FROM table_reference; |
Keyword
- alias: gives an alias for the attr_expr field.
- AS: Whether to add AS does not affect the result.
Precautions
- The to-be-queried table must exist. Otherwise, an error is reported.
- The alias must be specified before execution of the statement. Otherwise, an error is reported. You are advised to specify a unique alias.
Example
Run SELECT name AS n FROM simple_table WHERE score > 90 to obtain the subquery result. The alias n for name can be used by external SELECT statement.
1
|
SELECT n FROM (SELECT name AS n FROM simple_table WHERE score > 90) m WHERE n = "xiaoming"; |
Parent topic: Alias
Feedback
Was this page helpful?
Provide feedbackThank 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