1.select 班级,count(1) from B1 where 科目=‘语文' and 成绩>60 group by 班级
2.select avg(成绩),max(成绩) from B1 where 科目=‘语文’
3.update B1 set 成绩=成绩+5 where 班级=‘01’ and 科目=‘语文’
第一题:select t.classes,
count(*) from student t where t.score > 50 and subject = '语文' group by t.classes ;
第二题:select avg(t.score) 平均分,max(t.score) 最高分 from student t where subject = '语文';
第三题:update student set score = score+5 where classes = '一班';
第一题 select 班级 count(成绩>60) from 表名 group by班级 having count(成绩>60)
第二题: 平均AVG () 最大值 Max()
语句顺序
select 选择列
from 表
where 查询条件
group by 组属性 having 组滤条件
order by 排序属性
limit 起始记录位置取记录条数
3.select 班级as class,科目 as project, 成绩 as grade from B1
where class = '01' and project = '语文'
set grade = grade + 5;