我是SQL新手,大家一起交流,对于平均年龄最大的院系
select outer_a.id from (select d1.id as id,(select avg(s1.age) from student s1 where s1.dept_id = d1.id) as avg from dept d1) as outer_a where outer_a.avg = (
select max(avg) from (select d.id,(select avg(s.age) from student s where s.dept_id = d.id) as avg from dept d) as avg_list);
select 学生姓名,sum(case 成绩 > 60 then 科目学分 else 0 end) xuefen from 成绩表 关联课程表 关联 学生表 group by 学生姓名
你是要一个SQL直接实现这些吗?