By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
create table t(COURSE_ID int, SKILL_ID int)
insert into t select 1, 1
insert into t select 1, 2
insert into t select 2, 2
insert into t select 2, 3
insert into t select 2, 4
insert into t select 3, 1
insert into t select 4, 1
insert into t select 4, 2
8 rows affected
select Skill, Count(*) courseCount
from (
select course_id, Count(distinct SKILL_ID) Skill
from t
group by COURSE_ID
)s
group by Skill;
Skill | courseCount |
---|---|
1 | 1 |
2 | 2 |
3 | 1 |