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

preview_player
Показать описание

All the scripts and dataset used in this video can be downloaded for free from my discord. Link to join my discord below:

In this video, let's learn how to write Recursive SQL Queries. Learn to write SQL Queries using Recursion by solving different SQL queries. This video will explain the syntax to be followed to write recursive sql queries and we shall look at the difference in syntax in PostgreSQL, Oracle, MySQL and MSSQL.

I will also explain the process SQL follows to execute recursive sql query. Then we shall solve 3 different SQL queries using recursion. I will execute the queries in all the major RDBMS such as PostgreSQL, Oracle, MySQL and Microsoft SQL Server.

Consider SUBSCRIBING to my channel if you wish to learn SQL, Python and Data Analytics concepts.

FTC disclaimer: This video was sponsored by Brilliant.

🔴 WATCH MORE VIDEOS HERE 👇

✅ SQL Tutorial - Basic concepts:

✅ SQL Tutorial - Intermediate concepts:

✅ SQL Tutorial - Advance concepts:

✅ Practice Solving Basic SQL Queries:

✅ Practice Solving Intermediate SQL Queries:

✅ Practice Solving Complex SQL Queries:

✅ Data Analytics Career guidance:

✅ SQL Course, SQL Training Platform Recommendations:

✅ Python Tutorial:

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

Hi Thoufiq. I've been working with SQL (and teaching) for more than 2 decades and never found someone addressing SQL problems like you. The strongest aspects are problem-solving orientation (instead of theoretical) and ANSI standard queries (as much as possible). Congratulations! I'm recommending your videos to my students and workmates.

correialc
Автор

At last a clear, detailed and impressive explanation with real examples of what is, how it works and how to write a WITH RECURSIVE CTE.
BRAVO!!!

MimmoCRISTOFARO
Автор

Every single person who is working in SQL must have this channel in youtube subscribe list. I have recommended this channel to 3 colleague's & I am extremely happy to say they all liked this channel. And all 3 are thanking me 😍

sspinjari
Автор

Hey Thoufiq, I have become a big fan of your content off late. I think that I have subscribed and started watching your videos for a month or 2. However, I have completed watching every single video that you have uploaded so far. The way of teaching is excellent and the examples that you provide are the backbone for the concepts that you are explaining. Great work! Thanks for the amazing knowledge share!

karthikeyanpandian
Автор

Thank you so much for the detailed tutorial! I’ve been a data analyst for three years but never came across this technique until I received an interview from another company. Hope I can ace that SQL interview🤞

DinoDunelm
Автор

I've looked at dozens of RECURSIVE CTE tutorials but until this one, I couldn't find an explanation of the JOIN condition. Thank you ... exactly what I needed!

mike-wte
Автор

I did both these topics (CTE & recursive CTE) from LinkedIn learning; they made me feel like I can't learn but you make SQL so easy. Thanks for your content:-)
I'm at my first step as data analyst; looking forward to have help from you.

aakriti_
Автор

I've started my data science course and I thought that recursive cte wasn't meant for me but thanks to you i'm finally able to understand the logic behind it. Thanks Thoufiq.

claybyfrancisshop
Автор

Very well explained. I remember using the same concept when I had to generate the Voucher Code for one promotion feature. The voucher code should be AlphaNumeric and it should not already be present in the existing VoucherCodes table. It was very interesting and this concept had helped a lot.

sachinvishwakarma
Автор

I have watched so many videos regarding the same topic but really you made me understand very easily...thank you very much. keep teaching us.

santoshgowda
Автор

Literally I would say god level explanation, I was struggling with recursive query recently i had use case 👍

dhirendratripathi
Автор

You’ve taught me more in one week, than I learnt in one semester. GOAT STUFF!

theshanerap
Автор

Hi Thoufiq, I am a beginner learning Data Science course. Your teaching skills are very good and anyone can understand the way you explain. I really thank you for the SQL videos which are very useful and also I recommend to my friends to watch your videos.

SoumyaPriyaGodera
Автор

Definitely one of the better examples and succinct explanations. I liked how you reviewed the syntax first and came back to it when implementing.

Keep it up.

timothymalahy
Автор

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?

cbarlow
Автор

Hi @techTFQ,
I wanted to express my sincere gratitude for the invaluable knowledge I've gained through your videos. As an experienced data engineer, I have found your content to be exceptionally insightful and well-presented. Your selfless efforts and dedication to teaching have not gone unnoticed, and I truly appreciate the time you invest in sharing your expertise.

The clarity with which you explain complex concepts and the practical insights you provide on data analysis have been immensely beneficial to my learning journey. Your commitment to excellence in education is evident, and I wanted to take a moment to acknowledge and thank you for the positive impact you've had on my understanding of the subject.

I have enthusiastically recommended your channel to many of my colleagues who, like me, greatly appreciate the quality of your content. Please continue your outstanding work, as it is making a significant difference in the learning experiences of individuals in the data engineering community.
Thank you once again for your dedication and exceptional teaching.
Regards

sujaa
Автор

Great explanation. How to show the hierarchy up and additionally if a manager has another employee, besides the searched one, show him and hierarchy down, if searching down found employee has 2nd manager then show him too. So we show all hierarchy of the company.

dmitrii
Автор

Thank you so much for the video Taufiq. When I'm struggling to SQL problems, your videos are my first to go.

sql
Автор

Fantastic in my 10 years of IT i have not seen this in-depth tutorial. Amazing ✋

shahid
Автор

Your SQL videos are awesome & extraordinarily understoodable. Seems like taking a delicious chocolate everytime. Once again another SQL (recursive this time) is now clear like distilled water! Hats off bro!

towhidulrazu