sql how to get courses that i have made prerequisites

Solutions on MaxInterview for sql how to get courses that i have made prerequisites by the best coders in the world

showing results for - "sql how to get courses that i have made prerequisites"
Emma
30 May 2016
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
similar questions