Aliases must be used in SQL queries.
When do I need to use the table alias in SQL queries?
I encountered the problem of using the table alias when I wrote MySQL today. I 'd like to repeat it here.
1. The table name is very long.
Select * from www_baidu_user where www_baidu_user.id = 1;
And
Select * from www_baidu_user u where u. id = 1;
The query results are the same, but the second table alias is more concise. Similarly, the field alias works the same way.
2. When aliases are required
As follows:
1)
Select * from (select * from table1) as t1
This is the alias used to directly query all data from a subquery.
2)
Select B. name id, a. job, a. sex from A left outer join B B on B. id = a. id
This is used to query data in one or more columns. For example, if Table A does not have the name field, the table name or table alias must be included in the query. This is often used in connection queries.
The preceding section describes the alias used in SQL queries. I hope it will be helpful to you. If you have any questions, please leave a message and I will reply to you in a timely manner. Thank you very much for your support for the help House website!