Deze pagina is nog niet beschikbaar in uw eigen taal. We werken er hard aan om meer taalversies toe te voegen. Bedankt voor uw steun.

AS for Table

Updated on 2023-11-03 GMT+08:00

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;
    
Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback