做一个平均数,合计数的sql查询

做一个平均数,合计数的sql查询

 

select score as '成绩' ,name as '姓名' from students
UNION ALL
select AVG(score) from students;

在最后一行显示平均数;

select score as '成绩' ,name as '姓名' from students
UNION ALL
select SUM(score) from students;

在最后一个显示合计数;

原文地址:https://www.cnblogs.com/westsoft/p/15426699.html