关于数据库的select的一些小细节

129 阅读1分钟
select distinct `name`,(chinese+english+math) as score from student where score > 200;

当数据库需要对数据进行统计条件查询时,上述sql无法使用会报错,我认为where后面跟的时查询的条件在查询时,score是没有该字段的会报错

select distinct `name`,(chinese+english+math) as score from student order by score desc;

然而在order by是在数据查询完成之后再进行排序 所以不会报错