--平均成绩 select stuid, avg(score) from studentinfo where stuid = '001' --最高分数 select stuid, max(score) from studentinfo where stuid = '001' --查询所有 select stuid, classid, score from studentinfo where stuid = '001'
SELECT AVG(成绩) from tb where 专业='001'select max(分数) from tb where 专业='001'select 专业号,分数 from tb
--1 select 专业,avg(成绩)from tb where 专业='001' group by 专业 --2 select top 1 专业,sum(成绩) from tb where 专业='001' group by 专业 order by sum(成绩)desc --3 select 专业,avg(成绩)from tb group by 专业
1、avg 2、max 3、没明白要什么
假设此表有如下字段:sno,学号,s,分数,sspecial,专业 1.select avg(s) from tb where sspecial='001' 2.select max(s) from tb where sspecial='001' 3. --查询所有专业的平均分 select sspecial,avg(s) from tb group by sspecial --查询所有专业的最高分 select sspecial,max(s) from tb grop by sspecial
--平均成绩
select stuid, avg(score) from studentinfo where stuid = '001'
--最高分数
select stuid, max(score) from studentinfo where stuid = '001'
--查询所有
select stuid, classid, score from studentinfo where stuid = '001'
select 专业,avg(成绩)from tb where 专业='001' group by 专业
--2
select top 1 专业,sum(成绩) from tb where 专业='001' group by 专业 order by sum(成绩)desc
--3
select 专业,avg(成绩)from tb group by 专业
2、max
3、没明白要什么
假设此表有如下字段:sno,学号,s,分数,sspecial,专业
1.select avg(s) from tb where sspecial='001'
2.select max(s) from tb where sspecial='001'
3.
--查询所有专业的平均分
select sspecial,avg(s) from tb group by sspecial
--查询所有专业的最高分
select sspecial,max(s) from tb grop by sspecial
呵呵,这些都是我们第一学期刚刚学习SQL这门结构化查询语言时候练的基础题目。