きれいではありませんが、これが、第一正規形に違反したくない理由の1つであり、複数値の列があります...
select 'a' as grade, count(*) as occurrences
from student
where grade like '%a%'
union all
select 'b' as grade, count(*) as occurrences
from student
where grade like '%b%'
union all
select 'c' as grade, count(*) as occurrences
from student
where grade like '%c%'
union all
select 'd' as grade, count(*) as occurrences
from student
where grade like '%d%'
ここで実際の動作を確認してください。
または、 grades
Chris Kによって提案されたようなテーブルがある場合は、次のようなことを行うことができます。
select g.grade, count(s.student_name) as occurances
from
grades g
left join student s
on concat(',', s.grade, ',') like concat('%,', g.grade, ',%')
group by g.grade
ここで実際の動作を確認してください。