SQL之取别名

发布时间 2023-03-22 21:16:57作者: 默玖

as关键字

1、为表取别名

SELECT * FROM 表名 [AS] 表的别名 WHERE .... ;
select * from student as stu;

2、为字段取别名

SELECT 字段名1 [AS] 别名1 , 字段名2 [AS] 别名2 , ... FROM 表名 WHERE ... ;
select name as '姓名',id from student;