Для A вам необходимо объединить 2 таблицы, а затем group by lecturer, module
и подсчитать количество строк для каждой группы (каждая строка соответствует студенту):
select t.lecturer, t.module, count(*) numberofstudents
from teaches t inner join studies s
on s.module = t.module
group by t.lecturer, t.module
order by t.lecturer
Для B используйте NOT EXISTS
, чтобы найти модули со всеми оценками >= 40
и сосчитать их:
select count(distinct module) numberofmodules
from studies s
where not exists (
select 1 from studies
where module = s.module and grade < 40
)