When using an alias in the php namespace, MYSQL can take an alias for fields and table names, for example:
1) SELECT a. username, a. order FROM orders AS
Inner join user AS B ON a. username = B. username; -- alias for the table
2) select count (goods_id) AS totalGoods FROM tdb_goods; -- alias for the field
1) alias is used for the table, which avoids ambiguity. if the condition after ON is changed to username = username, it is clear that
An error will be reported. of course, you can change it to order. username = uer. uername, but it is not easy to get an alias.
From 2) we can see that taking an alias for a field can make the meaning clearer and improve readability.
In the PHP namespace, you can also take an alias for the namespace identifier. the benefit is that the alias in MYSQL is
The same.
Example:
Declare the namespaces root \ sub1 and root \ sub2;
Running result:
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.