Recursive SQL Queries Tutorial | Learn to write SQL Queries using Recursion

Recursive SQL Queries Tutorial | Learn to write SQL Queries using Recursion

techTFQ

2 года назад

199,257 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@pillslifestylereviews6714
@pillslifestylereviews6714 - 04.12.2023 07:37

Amazing! Thank You!

Ответить
@aneesh8991
@aneesh8991 - 01.12.2023 00:08

nice

Ответить
@youssefjemal2433
@youssefjemal2433 - 29.11.2023 00:38

This video helped me a lot, Thanks !

Ответить
@gauravgupta5530
@gauravgupta5530 - 28.11.2023 21:23

SUPPERB VIDEO


create table sales (
product_id int,
period_start date,
period_end date,
average_daily_sales int
);

insert into sales values(1,'2019-01-25','2019-02-28',100),(2,'2018-12-01','2020-01-01',10),(3,'2019-12-01','2020-01-31',1);


select period_start, period_end, datediff(period_end, period_start) as diff from sales;

with recursive cte as (
select period_start as start, period_end as end,
product_id, average_daily_sales
from sales
UNION ALL
select DATE_ADD(start, INTERVAL 1 DAY), end, product_id, average_daily_sales from cte
where DATEDIFF(end, start) > 0
)

select YEAR(start), product_id, count(*), sum(average_daily_sales) from cte
group by YEAR(start), product_id
order by product_id, YEAR(start);

To learn this concept more precisely

Ответить
@jullienbeaufondcamacho2055
@jullienbeaufondcamacho2055 - 28.11.2023 12:26

Superb explanation! 👏

Ответить
@praveensinghaws
@praveensinghaws - 27.11.2023 14:25

Hi Taufiq Sir , Very informative Video , sir please one request i have mac mini m2 i want to install Oracle DB please guide 🙏🙏

Ответить
@user-ld9sd4ty9y
@user-ld9sd4ty9y - 27.11.2023 03:37

Is nestled recursive query feasible in SQL?

Ответить
@mohitgoel3808
@mohitgoel3808 - 25.11.2023 14:26

Hi Thoufiq pls make a tutorial on Ceil, floor, Absolute value & while loop for SQL if it is possible for you..

Ответить
@mauricioroldanramirez821
@mauricioroldanramirez821 - 21.11.2023 03:37

Thank you so much!

Ответить
@mohitgoel3808
@mohitgoel3808 - 14.11.2023 07:06

Hi techTFQ make a tutorial on user-defined functions

Ответить
@asifn7634
@asifn7634 - 05.11.2023 21:42

Can any one help me to find 1 to 50 numbers using recursion and also specifying numbers as even and odd.❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤

Ответить
@mehdi4194
@mehdi4194 - 05.11.2023 11:55

so in mysql recursive is just a regular 'with clause'?

Ответить
@ArghyaDas793
@ArghyaDas793 - 25.10.2023 11:54

Hi Thoufiq, what if the ask is to show only the immediate sub-ordinates of Asha?

Ответить
@mohd.saquibusmani953
@mohd.saquibusmani953 - 24.10.2023 16:20

At which point in second question join condition will fail? please help me to understand this

Ответить
@user-bn1ne5uf6z
@user-bn1ne5uf6z - 06.10.2023 13:59

kidhar se ho bhai aap

Ответить
@vidya9587
@vidya9587 - 04.10.2023 19:29

Brilliant Tutorial

Ответить
@loloygodbless2127
@loloygodbless2127 - 27.09.2023 15:10

What is the error if only asha shows?

Ответить
@zoon-tech
@zoon-tech - 23.09.2023 06:30

Thank you!

Ответить
@rohitrc1723
@rohitrc1723 - 15.08.2023 18:14

You explain complex topics in a very intuitive manner. Awesome content!! I was having a hard time understanding recursive CTEs, but after watching this - everything seems crystal clear about recursive CTEs :)

Ответить
@kamalikamukherji6482
@kamalikamukherji6482 - 29.07.2023 06:43

Sir one on cursor implementation

Ответить
@culturadocaractere
@culturadocaractere - 23.07.2023 22:56

Very good job man

Ответить
@shaikhanuman8012
@shaikhanuman8012 - 21.07.2023 05:33

Tq for sharing valuable information, sir.

Ответить
@alexeymatveev9031
@alexeymatveev9031 - 20.07.2023 01:38

Wow

Ответить
@anjali.8296
@anjali.8296 - 16.07.2023 08:48

could you please tell
what is the difference between connect by clause and recursive ..same series or hierarchy data we can also print using connect by clause

Ответить
@cristhianalexander6805
@cristhianalexander6805 - 15.07.2023 20:03

thank you some much!!!!!!!

Ответить
@ParamjeetBhambra
@ParamjeetBhambra - 08.07.2023 21:32

Hi Thoufiq.
I have a question on using recursive CTE on multiple tables. Please advise where can I post that question. I would really appreciate your help. Thanks.

Ответить
@pankhudibhonsle5148
@pankhudibhonsle5148 - 06.07.2023 10:07

Your video was the best resource for learning recursive queries I came across on the internet so far !

Ответить
@cbarlow3
@cbarlow3 - 26.06.2023 23:28

Excellent explanation, Thofique! I like how when you ran the second example in multiple DBMSs, you went in an order that made you do an ever-increasing number of changes. :) I'll add another layer: if you were using Db2, you would have to 1. remove the RECURSIVE keywork, 2. use UNION ALL instead of UNION (I generally discourage using UNION by itself anyway), 3. specify column aliases as part of your CTE syntax (so far all the same changes you need for Oracle)...AND you also can't do an INNER JOIN in your recursive CTE! Not a problem for Example 1 (output integers 1 through 10), but for Example 2 it means you would have to go back in time to a time before INNER JOIN was invented (pre-1992!) and change your (INNER) JOIN to a Cartesian join (using the old-school comma-separated list of tablenames...not even the CROSS JOIN syntax!) followed by the appropriate WHERE clause to ensure you only get back the same rows that you would have with an INNER JOIN. Weird, right?

Ответить
@CassStevens
@CassStevens - 15.06.2023 18:29

Why does SQL Server still show all the red squiggle lines under most of the query even though everything works? Thanks.

Ответить
@swatiojha5913
@swatiojha5913 - 13.06.2023 12:08

Excellent!

Ответить
@alokbehera3284
@alokbehera3284 - 12.06.2023 07:31

where can I get this database?

Ответить
@sadafshahbaz2488
@sadafshahbaz2488 - 11.06.2023 21:02

wonderful explanation.

Ответить
@reveller00
@reveller00 - 06.06.2023 18:34

I like your ears.

Ответить
@suyash7450
@suyash7450 - 24.05.2023 09:57

Watching your videos makes me Believe that Learning SQL is not that difficult as it seems when we learn from an online course or any other portal, your way of explaining concepts both theoretical and practical is very simple and even a beginner can learn with ease. keep doing the great work.

Ответить
@Rockythepom
@Rockythepom - 11.05.2023 08:50

A detailed explanation of confusing recursive query. simply Awsome

Ответить
@jaewonyang
@jaewonyang - 06.05.2023 18:55

Excellent explanation! Thank you very much.

Ответить
@SwethaNandyala-sf9lt
@SwethaNandyala-sf9lt - 18.04.2023 08:34

Cant thank you enough for your content and explaination....lots of admiration from banaglore

Ответить
@shradarai1068
@shradarai1068 - 12.04.2023 22:41

sir i didn't get the purpose of 'union' and 'lvl' functions here, could you please make a video on these two things.

Ответить
@shahzadqasir5122
@shahzadqasir5122 - 11.04.2023 18:58

Thanks for the Video Tutorial

Ответить
@puneetaggarwal7549
@puneetaggarwal7549 - 04.04.2023 01:22

Looking at your queries and way of explanation I wonder why I wasted my money on some SQL course. God why didn't I find your playlist earlier.

Ответить
@kosmipologe
@kosmipologe - 21.03.2023 22:08

Awesome video, very well explained. Thank you. Just one little thing with the last example. I wished you would have changed the level number backwards somehow.

Ответить
@pradyumnamohapatra2448
@pradyumnamohapatra2448 - 11.03.2023 18:07

so clearly explained Taufiq...your videos really do magic...thank you so much and keep posting such learning videos

Ответить
@faizanwar_
@faizanwar_ - 08.03.2023 12:25

Thoufiq Sir , you are best in the business for sure

Ответить
@mohammadislam4314
@mohammadislam4314 - 05.03.2023 04:48

You seems make it so easy but it really not unless you can solve some of your own

Ответить
@majidnabavi9900
@majidnabavi9900 - 03.03.2023 17:36

Best explanation , thank you ;)

Ответить
@alanmiles6680
@alanmiles6680 - 25.02.2023 04:11

Usually, great tutorials from him. However, for this particular tutorial, I had to Google, "What is a recursive query?" in the first place.

Ответить
@chittillavenkataviswanath1389
@chittillavenkataviswanath1389 - 20.02.2023 07:00

Looks AS COOL AS CUCUMBER

Ответить
@AlexanderPoznanski
@AlexanderPoznanski - 18.02.2023 01:08

Thank you! Interesting!

Ответить
@QelDoQ
@QelDoQ - 16.02.2023 03:13

Thank you! This explained things so clearly.

Ответить