mysql面试

1、聚合函数:count、avg、sum、max、min、round(avg(字段),2):取两位小数

2、

-- 3、查询平均成绩大于等于60分的同学的学生编号和学生姓名和平均成绩
select b.s_id,b.s_name,ROUND(AVG(a.s_score),2) as avg_score from 
    student b 
    join score a on b.s_id = a.s_id
    GROUP BY b.s_id,b.s_name HAVING ROUND(AVG(a.s_score),2)>=60;
-- 10、查询学过编号为"01"但是没有学过编号为"02"的课程的同学的信息
 
select a.* from 
    student a 
    where a.s_id in (select s_id from score where c_id='01' ) and a.s_id not in(select s_id from score where c_id='02')
原文地址:https://www.cnblogs.com/wangkc/p/10859725.html