you can alias fields and table names in MYSQL such as:
1)SELECT a.username,a.order from orders as a
INNER JOIN user as B on a.username=b.username; -- alias the table
2) SELECT COUNT (goods_id) as totalgoods from Tdb_goods; -- alias the field
1) in the table alias, avoid two semantics, if on the following conditions changed to Username=username, obviously
will be error, of course, can also be changed to Order.username=uer.uername, but no alias to the simple.
From 2) We can see that the alias of the field can make the meaning clearer and improve the readability.
namespace identifiers can also be aliased in the PHP namespace, and the benefits and aliases in MYSQL are
The same.
As in the following example:
declaring namespaces Root\sub1 and root\sub2;
Operation Result:
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Use of aliases in the PHP namespace