做一个平均数,合计数的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;

在最后一个显示合计数;

posted @ 2019-06-16 21:30  Thenext  阅读(1019)  评论(0编辑  收藏  举报