Home > Database > Mysql Tutorial > How to query data and create aliases in mysql

How to query data and create aliases in mysql

青灯夜游
Release: 2022-01-04 14:21:23
Original
12507 people have browsed it

In mysql, you can use the "SELECT" statement and the "AS" keyword to query data and create aliases. The syntax is "SELECT field name/* FROM table name AS table alias;" or "SELECT field name AS field alias FROM data table name;".

How to query data and create aliases in mysql

The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.

Specify an alias for the table

When the table name is very long or some special queries are executed, for the convenience of operation, you can specify an alias for the table. Alias, use this alias to replace the original name of the table.

The basic syntax format for specifying an alias for a table is:

<表名> [AS] <别名>
Copy after login

The meaning of each clause is as follows: