Recursive Queries¶
Recursive queries are queries which call themselves within their contents.
Example¶
WITH RECURSIVE rec_prereq(course_id, prereq_id) AS (
SELECT course_ID, prereq_ID
FROM prereq
UNION
SELECT rec_prereq.course_ID, prereq.prereq_ID
FROM rec_rereq INNER JOIN prereq
ON rec_prereq.prereq_ID = prereq.course_ID
)
SELECT *
FROM rec_prereq