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

在最后一个显示合计数;

标签:studentsUNION,name,students,平均数,查询,score,sql,ALLselect,select
来源: https://www.cnblogs.com/Thenext/p/11033050.html