Mysql alias

1. Column Aliases

1. To add an alias to a column, you can use a ASkeyword followed by an alias, for example:SELECT [column_1 | expression] AS descriptive_name FROM table_name;

2. If the alias contains spaces, the following must be quoted:SELECT [column_1 | expression] AS `descriptive name`FROM table_name;//别名加上双引号。

3. CONCAT_WSThe function is used to connect the first name and last name, and can be used with AS, for example:SELECTCONCAT_WS(', ', lastName, firstname) AS `Full name`FROM employees;

 

2. Table alias

1. You can use aliases to add different names to tables. Use ASkeywords to assign aliases to table names, as in the following query syntax:table_name AS table_alias

 

 

 


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324507930&siteId=291194637