--为什么下面的语句不能执行?
--答:
--1、在select 语句执行前,from,where,group by 和 having 子句先执行,而对表列重命名的操作是在select 子句中完成的
--因此在其前执行的子句均不能使用重命名后的列名。只有order by 子句是在select 子句执行后才执行的,所以在order by 子句
--中可以使用列的别名。
--select 语句执行顺序
--1、from 子句
--2、where 子句
--3、group by 子句
--4、having 子句
--5、select 子句
--6、order by 子句
--表的别名与列的别名不同,表的别名是在from 子句中定义的
use school
select [id] as '编号',name as '学生姓名'
from student
where 编号>2
order by 编号