1. 程式人生 > >SQL資料庫經典練習題

SQL資料庫經典練習題

select c_id 課程ID,        (select cname from course t1 where t1.c_id=t2.c_id) 課程名稱,        count(distinct case when score between 85 and 100 then s_id end ) "[85-100分]人數",        count(distinct case when score between 70 and 85 then s_id end ) "[75-85分]人數",        count(distinct case when score between 60 and 70 then s_id end ) "[60-70]人數",        count(distinct case when score <60 then s_id end ) "小於60分人數"        from sc t2 group by c_id ;