-- 檢索"01"課程分數小於60,按分數降序排列的學生信息
select t2.* from score t1, student t2 where t2.s_id = t1.s_id and t1.s_score < '60' and t1.c_id = '01' order by t1.s_score;
-- 按平均成績從高到低顯示所有學生的所有課程的成績以及平均成績
select a.*, b.c_id, b.s_score from student a, score b where a.s_id = b.s_id and b.c_id = '01' and b.s_score<60 order by b.s_score desc; select a.s_id, ( select s_score from score where s_id = a.s_id and c_id = '01') as 語文, ( select s_score from score where s_id = a.s_id and c_id = '02') as 數學, ( select s_score from score where s_id = a.s_id and c_id = '03') as 英語, round(avg(a.s_score), 1) from score a group by a.s_id order by avg(a.s_score) desc;
--2019/04/28