Find at least one record from two where conditions from a join table

Solution 1:

In this case, it would be better to use in operator to avoid logical mistakes related to parentheses, also you should use count with distinct to avoid counting the same types.

select sc.student_id
from student_course sc inner Join course c on sc.course_id = c.id
where c.type In ('Maths','Science') and c.id in (1,3,5)
group by sc.student_id 
having Count(distinct c.type) = 2

db<>fiddler

Result:

student_id
101