查询 tb_students_info 表,为 name 指定别名 student_name,为 age 指定别名 student_age
mysql> SELECT name AS student_name, age AS student_age FROM tb_students_info; +--------------+-------------+ | student_name | student_age | +--------------+-------------+ | Dany | 25 | | Green | 23 | | Henry | 23 | | Jane | 22 | | Jim | 24 | | John | 21 | | Lily | 22 | | Susan | 23 | | Thomas | 22 | | Tom | 23 | +--------------+-------------+ 10 rows in set (0.00 sec) 注意:表别名只在执行查询时使用,并不在返回结果中显示。而字段定义别名之后,会返回给客户端显示,显示的字段为字段的别名。