第1题: select m.student.id,student_name,student_class,course_name,course_score from Student m left join STUDENT_SCORE n on m.student.id=n.student.id where student_class='A' order by course_name asc,course_score desc;
select A.student_id,A.student_name,A.student_class,B.course_name,B.course_score
from (select * from student where student_class=‘A’) as A
inner join student_score as B on A.student_id=B.student_id
group by A.student_id,A.student_name,A.student_class,B.course_name,B.course_score
order by B.course_name, B.course_score desc;
select course_name,sum(case when course_score < 60 then 1 else 0 end) as s from student_score
group by course_name having s>3;
select A.student_id,A.student_name,
A.student_class,A.student_sex,
(case when B.address is NULL or length(B.address)=0 then ‘暂无’ else B.address end) as address,
(case when B.telphone is NULL or length(B.telphone)=0 then ‘暂无’ else B.telphone end) as telphone,
from student as A inner join student_family as B on A.student_id=B.student_id;
人员名称重复数量
select name,count(1) as s from table1 group by name having s>1;
1,
select s.student_id, s.student_name, s.student_class, c.course._name , c.course_score
from Student s
left join
STUDENT_SCORE c
on s.student_id=c.student_id
order by c.course._name ASC, c.course_score DESC;
2,select course._name, count(student_id)
from STUDENT_SCORE where course_score<60
having count(student_id) >3