Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
The very basics
Infinite looping
Processing trees with recursive CTEs
Processing graphs with recursive ctes
Summary

Instruction

Let's get started, then. You might or might not have heard about recursion before. In either case, it's good to clarify what it is.

Is there recursion in real life? Yes, there is. Take a good look at the Romanesco broccoli shown below. Its cones are made of smaller cones which are, in turn, made of yet smaller cones that are made of even smaller cones...

recursion

Another example could be the famous Russian matryoshka dolls. If you open the biggest doll, you will see a smaller one. Once the smaller one is opened, you can see yet a smaller one, which in turn has another smaller doll inside itself.

recursion

In each case, we can say that a pattern repeats itself. Formally speaking, recursion takes place when something is defined in terms of itself. A Romanesco broccoli cone is a cone made of smaller Romanesco broccoli cones. A matryoshka doll is a doll which holds a smaller matryoshka doll inside.

Exercise

Click Next exercise to continue.