-- run this to use test: db2 -tvmf test.sql
with eachclass (sectioncount) as
(select count(*) from class
  where term = 1185
  group by (deptcode, cnum))
select count(*), sectioncount from eachclass group by sectioncount;
