1 为表取别名
mysql> select * from students;
+----+--------+-------+------+------+
| id | number | name | sex | age |
+----+--------+-------+------+------+
| 1 | 1111 | LiLy | W | 12 |
| 2 | 1112 | Lucy | W | 11 |
| 3 | 1113 | LiLei | M | 13 |
| 4 | 1117 | Bird | NULL | 33 |
+----+--------+-------+------+------+
4 rows in set (0.00 sec)
mysql> select s.name from students as s where age>12;
+-------+
| name |
+-------+
| LiLei |
| Bird |
+-------+
2 rows in set (0.00 sec)
2 为字段取别名
mysql> select name as student from students where age<20;
+---------+
| student |
+---------+
| LiLy |
| Lucy |
| LiLei |
+---------+
3 rows in set (0.00 sec)