MySQL Field uses as
In MySQL, a select query can use the AS keyword to alias the field of a query, which is used as the column name for an expression, and the alias can be used in statements such as group By,order by or having. For example:
SELECT CONCAT (last_name, ', ', first_name) as Full_name from MyTable order by Full_name;
When used with a select query, the AS keyword is optional. The above SQL statement can also be written like this:
SELECT CONCAT (last_name, ', ', first_name) Full_name from MyTable order by Full_name;
Because as is optional, if you forget to enter a comma between the query fields, MySQL will use the second field as the alias for the first field. For example, COLUMNB is considered an alias for columna in the following SQL statement:
SELECT Columna columnb from MyTable;
For this reason, it is recommended that you add the AS keyword when using aliases.
MySQL table uses as
A table can specify aliases using the Tbl_name as Alias_name or tbl_name alias_name:
SELECT T1.name, t2.salary from employee as T1, info as t2 WHERE t1.name = t2.name;
SELECT T1.name, t2.salary from employee T1, info T2 WHERE T1.name =t2.name;
Look at one more example:
SELECT Employee.first_name, Job.title, Duty.task from employee left join job on employee.id = Job.id left join duty on EMP Loyee.id = Duty.id WHERE (job.title = ' Manager ');
Through this article I hope you can understand the knowledge of MySQL as information, thank you for the support of this site!