Help Center/
Data Lake Insight/
SQL Syntax Reference (To Be Offline)/
Spark SQL Syntax Reference (Unavailable Soon)/
Alias/
AS for Table
Updated on 2023-11-03 GMT+08:00
AS for Table
Function
This statement is used to specify an alias for a table or the subquery result.
Syntax
1 |
SELECT attr_expr_list FROM table_reference [AS] alias;
|
Keyword
- table_reference: Can be a table, view, or subquery.
- As: Is used to connect to table_reference and alias. Whether this keyword is added or not does not affect the command execution 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
- To specify alias n for table simple_table and visit the name field in table simple_table by using n.name, run the following statement:
1
SELECT n.score FROM simple_table n WHERE n.name = "leilei";
- To specify alias m for the subquery result and return all the query results using SELECT * FROM m, run the following statement:
1
SELECT * FROM (SELECT * FROM simple_table WHERE score > 90) AS m;
Parent topic: Alias
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.
The system is busy. Please try again later.