You can obtain an alias for the table and field during query. This alias can replace the specified table and field.
Alias for table
CopyCode The Code is as follows: mysql> select * from department d
-> Where D. d_id = 1001;
+ ------ + ----------- + -------------- + ------------- +
| D_id | d_name | function | Address |
+ ------ + ----------- + -------------- + ------------- +
| 1001 | Ministry of Science and Technology | R & D product | layer 5, building 3 |
+ ------ + ----------- + -------------- + ------------- +
Row in SET (0.00 Sec)
Here, a specific department table named D is retrieved.
Alias for Field
Copy code The Code is as follows: mysql> select d_id as department_id, d_name as department_name
-> From department;
+ --------------- + ----------------- +
| Department_id | department_name |
+ --------------- + ----------------- +
| 1001 | Ministry of Science and Technology |
| 1002 | Production Department |
| 1003 | sales department |
+ --------------- + ----------------- +
Rows in SET (0.00 Sec)
The syntax here is similar to the above except that the