select e.mark, course, g.name, s.name, lastname, surname, p.name, f.name from students s
left join groupa g on s.group_id = g.id
inner join exam_mark e on s.id = e.student_id
inner join peciality p on g.peciality_id = p.id
inner join facult f on p.facult_id = f.id
where e.mark >= 4
and not exists (select 1
from exam_mark e1
where e1.student_id = s.id
and e1.mark <> 2)