Mysql field as details and instance code, mysql field as details
Mysql field uses
In mysql, the select query can use the AS keyword to create an alias for the queried field. This alias is used AS the column name of the expression, and the alias can be in group, order by or HAVING. For example:
Select concat (last_name, ',', first_name) AS full_name FROM mytable order by full_name;
The AS keyword is optional when aliases are used together with select queries. The preceding SQL statement can also be written as follows:
Select concat (last_name, ',', first_name) full_name FROM mytable order by full_name;
AS is optional. If you forget to enter a comma between Query fields, MySQL uses the second field AS the alias of the first field. For example, in the following SQL statement, columnb is treated as the alias of columna:
SELECT columna columnb FROM mytable;
For this reason, we recommend that you add the as keyword when using the alias.
Mysql tables use the
A table can use tbl_name AS ALIAS_NAME or tbl_name ALIAS_NAME to specify an alias:
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;
Let's look at another instance:
SELECT employee. first_name, job. title, duty. task FROM employee left join job ON employee. ID = job. id left join duty ON employee. ID = duty. id where (job. title = 'manager ');
Through this article, I hope you can understand the knowledge and materials of mysql as. Thank you for your support for this site!