Summary for Recursion

Summarize the key insights you’ve explored about recursion in MySQL.

Recursion is a phenomenon in which something is defined in terms of itself. In computer science, recursion refers to a function that calls itself as part of its definition. In the sense of divide and conquer, recursion allows one to solve a complex problem in smaller, simple steps.

Recursive common table expressions (CTEs)

In MySQL, recursion is implemented through recursive CTEs:

Press + to interact
WITH [RECURSIVE]
cte_name [(col_name [, col_name] ...)] AS (subquery)
[, cte_name [(col_name [, col_name] ...)] AS (subquery)] ...

With RECURSIVE, we are allowed to refer to cte_name ...

Access this course and 1400+ top-rated courses and projects.