Recursive CTE

A CTE that references itself is called as recursive CTE. Recursive CTE's can be of great help when displaying hierarchical data.



WITH NumbersCTE AS
(
    SELECT  1 AS Number
    UNION ALL
    SELECT Number + 1 FROM NumbersCTE
    WHERE Number <10
 )
SELECT * FROM NumbersCTE

No comments:

Post a Comment

What is Normalization?

Database normalization is a data design and organization process applied to data structures based on rules that help building relational dat...