How do SQL Recursive CTE queries work

preview_player
Показать описание
In this video, you are going to learn how SQL Recursive CTE queries work.

This video is part of my HIgh-Performance SQL video course, so if you liked this video, you are going to love my video course.

Рекомендации по теме
Комментарии
Автор

Excellent content. Very well explained. Thanks Vlad!

dschulzg
Автор

Hi Vlad, thanks for your video. May I have several questions as below:

1. why when the first statement "select 0, 0" executed, then these 0, 0 sent to i, and consecutive_sum? while the whole statements within "With" haven't finished yet?

2. IN the second statment i.e. recursive statement "select i + 1, i + 1 + consecutive_sum from consecutive_sum_number" And when i + 1, i+1 + consecutive_sum will be sent to i, and consecutive_sum again for the next iteration?

In short, it doesn't look like a native recursive isn't it? cause it doesn't seem to be function call same function, so everytime when consecutive_sum is call then within this function we have select 0, 0, union with something. it quite confused me.

Thank you

phuphan