Introduction to Recursive CTE
by cyril2mOctober 21st, 2020 Too Long; Didn't Read
Recursive CTE is a CTE (Common Table Expression) is a temporary named result set that you can reference within a SELECT, INSERT, UPDATE, or DELETE statement. Recursion queries are used to query hierarchical data. It avoids a cascade of queries, you can only do one query to retrieve the hierarchical data. The CTE has a subquery that refers to its own name. The WITH clause must begin with "WITH RECURSIVE" or "UNION [ALL]" The first part produces the initial row(s) for the CTE. The second part recurses by referring to the name in its FROM clause.