1SET @courses_completed = '2';
2SELECT c.course_id
3FROM course c
4LEFT JOIN course_prerequisites p ON p.course_id = c.course_id
5WHERE NOT FIND_IN_SET(c.course_id, @courses_completed)
6GROUP BY c.course_id
7HAVING SUM(COALESCE(FIND_IN_SET(p.prerequisite_course_id, @courses_completed), 0) > 0) = COUNT(p.prerequisite_course_id);
8