You can obtain an alias for the table and field during query. This alias can replace the specified table and field.
Alias for table
MySQL > Select * From Department d -> Where D. d_id = 1001 ; + -- ---- + ----------- + -------------- + ------------- + | D_id| D_name | Function | Address | + -- ---- + ----------- + -------------- + ------------- + | 1001 | Ministry of Science and Technology | R & D products | Layer 5, building 3 | + -- ---- + ----------- + -------------- + ------------- + 1 Row In Set ( 0.00 Sec)
Here, a specific department table named D is retrieved.
Alias for Field
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 | + -- ------------- + ----------------- + 3 Rows In Set ( 0.00 Sec)
The syntax here is similar to the above except that the