SQL WITH Clause | How to write SQL Queries using WITH Clause | SQL CTE (Common Table Expression)

  Рет қаралды 597,490

techTFQ

techTFQ

Күн бұрын

Пікірлер: 678
@techTFQ
@techTFQ 2 жыл бұрын
Please note the COST column used in this table represents the total cost of purchase hence we do not need to multiple quantity with cost to get the total cost. I designed the dataset with an assumption that COST is the total purchase cost.
@eijazhussainsheikh2637
@eijazhussainsheikh2637 2 жыл бұрын
then it becomes easy...
@gotchihaeyo1825
@gotchihaeyo1825 2 жыл бұрын
What if we have to calculate quantity × price first? Does Sum(quantity*price) work?
@chandramoulireddymarthala3721
@chandramoulireddymarthala3721 2 жыл бұрын
Yeah your videos are really helping me to understand this course
@maggienalwabwe7288
@maggienalwabwe7288 2 жыл бұрын
Hello, please help me reconstruct this using SELECT. The with clause isn’t supported WITH seq(n) AS (SELECT 0 UNION ALL SELECT n + 1 FROM seq WHERE n < DATEDIFF(DAY, '20210101', (DATEADD(DAY, -1, DATEADD(YEAR, 30, '20210101'))))), d(d) AS (SELECT DATEADD(DAY, n, '20210101') FROM seq) SELECT d, COUNT (*) ON a.dogma_registereddate = d OR a.dogma_removeddate IS NULL) WHERE a.dogma_charitynumber != 'SC000036' GROUP BY d ORDER BY d OPTION (MAXRECURSION 0);
@ananda7469
@ananda7469 2 жыл бұрын
Sir can you please explain why did you give X as alias and also again avg_sales as alias but confused
@LazyPvPing
@LazyPvPing 3 жыл бұрын
You're the best resource I have found! I've taken classes on Udemy and everything but it's nothing like this. I graduate from college in December and I'm pursuing a career in Data Analytics. Your videos are definitely going to help me with my upcoming interviews. God bless you brother! You have helped me to understand SQL on a whole another level!
@techTFQ
@techTFQ 3 жыл бұрын
I am so glad to hear this bro :) Happy to know my videos have helped you to understand SQL. Thank you for the amazing feedback :)
@akshaykumarsingh9770
@akshaykumarsingh9770 2 жыл бұрын
That's correct @ItsReflexes, he is awesome 🙂
@techTFQ
@techTFQ 2 жыл бұрын
Thank you once again Akshay 🙏🏼
@LazyPvPing
@LazyPvPing 2 жыл бұрын
UPDATE : I signed a job offer with a great compensation range. In addition, I had 3+ companies to choose from. Hard work does pay off!
@techTFQ
@techTFQ 2 жыл бұрын
Congratulations buddy 💐 I am so happy for your success 👌 All the best 👍
@JR-ly6bx
@JR-ly6bx 2 жыл бұрын
alot of people just show how to make the query, what I call "watch me type". You actually teach the how and whys. i learned alot with your channel. thanks
@kambojiganesh2265
@kambojiganesh2265 Жыл бұрын
Most underrated KZbin channel i have seen, you have rocked all the sql videos man
@17stevedrew
@17stevedrew 2 жыл бұрын
This video on the with clause gave me a solution to a query I have been trying to write for a month. I can't thank you enough. Now the query works as it should and is readable! I had tried various unions, exists, partition statements to isolate some data. It did not work, this did! 😀
@matiassquartini2467
@matiassquartini2467 8 ай бұрын
from zero to super hero with you man, massive thanks to do it easier.
@mdrashadulislam7121
@mdrashadulislam7121 Жыл бұрын
I have been working two and a half years as a Data Management Officer at icddr,b Bangladesh. Now, I am learning SQL to become a data analyst. I found your video classes very useful, effective and eloquently explained. Thanks techTFQ👌.
@RvRaaphorst
@RvRaaphorst 2 жыл бұрын
Another big advantage is when using CTE's for inserting/updating records in multiple rows (One-to-one, or one-to-mamy), you can use the returned id in the other queries. Mutiple modifications in a single query reduce overall latency from a code perspective. Moreover, a CTE is executed as a transaction, so you won't need to start/commit a transaction in your code.
@humansizedaperture
@humansizedaperture 5 ай бұрын
Awesome. I use with all the time. As a data analyst I write for single use code so I often don’t write very efficiently. Using a with clause to get the initial dataset to just look a little bit more like the target dataset and then using it again until I incrementally achieve the target dataset is pretty much my solution. Almost every time.
@Anand-ct8rp
@Anand-ct8rp 6 ай бұрын
You are the best instructor who explains tough things in a very simple way. Appreciate your work..!!!
@Hannnkyo
@Hannnkyo 4 ай бұрын
The very video explaining what I wanted to know about CTE. So clear about why and when to use CTE. Thank you!
@rishabh_fitness3273
@rishabh_fitness3273 Жыл бұрын
i have never seen someone like you to be that perfect in sql ever. hats off taufiq ,god bless you SIR♥
@sogolll
@sogolll 2 жыл бұрын
Thank you for this video, I was using CTE's only for deleting duplicates and I was so confused when I should use these and what they are for. You explained it so well. I'm glad I finally understand CTE.
@techTFQ
@techTFQ 2 жыл бұрын
glad this helped
@talknow2859
@talknow2859 5 ай бұрын
I had to go through this 3x to really understand the with clause concept. Thanks a whole bunch 🎉.
@Nikhilg-rs7iv
@Nikhilg-rs7iv 6 ай бұрын
thank you so much man i was just blindly copy pasting the cte queries without understanding how it actually works and I am glad to find this channel, bro explained the concept like we explain everything to 1 year old babies
@Devdumplings
@Devdumplings 9 ай бұрын
This is the best video on CTE. Thanks a lot for explaining in a simple way. 🙌
@mysubscription104
@mysubscription104 2 жыл бұрын
Simple but elegant explanation about WITH clause, thanks for creating these videos and sharing your knowledge .....
@techTFQ
@techTFQ 2 жыл бұрын
Glad you liked it 🙏🏼
@davidloewen5528
@davidloewen5528 2 жыл бұрын
I use CTE in almost every production query I write. After the first sub query, I always format the alias name with leading comma as , as ( Select …. ) , as ( -- The reason for this is when revisiting the query a year later, I just need to comment out any alias name row and highlight from top to and including the query with the alias commented out, and examine any intermediate results. Excellent technique when a business person wants to see how something is being generated. Use white space above and below these lines. My tip? Format for functionality, use leading commas.
@KamalKToronto
@KamalKToronto 2 жыл бұрын
I am obsessed with your channel, I have been working with SQL for so long and I used to run away from window functions but you explain it so nice and clear. I learned by working on it so was never clear on concepts but thank god for your Chanel !
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Kamaljeet 🙏🏼 I am glad to read this comment and happy to know my contents have helped you
@hammadyasir2174
@hammadyasir2174 5 ай бұрын
Great Teacher.i never seen a person who explain complex stuff in a easy and simple way.
@jhonsen9842
@jhonsen9842 2 жыл бұрын
Undoubtly your course is the best resource not only in youtube but also whatever available in internet that to be free.
@sahilgogna3393
@sahilgogna3393 2 жыл бұрын
I was getting hopeless with my sql learning. This channel gave me a new direction. This is the first video that I watched. Now I am going to practice from your sql practice playlist.
@techTFQ
@techTFQ 2 жыл бұрын
Awesome Sahil 👌 Very happy to read this comment.. I am glad this helped you
@vikramarora5170
@vikramarora5170 2 жыл бұрын
THIS IS THE WAY ONE SHOULD TEACH... TOO GOOD
@techTFQ
@techTFQ 2 жыл бұрын
Thank you very much Vikram 🙏🏼 Appreciate your feedback ☺️
@MS-dp9xx
@MS-dp9xx 2 жыл бұрын
I have watched many SQL videos and I hardly comment. Thank you and appreciate your videos, I found them very beneficial and what makes real difference in your videos is you explain the rational of why we need to use and its pros and cons. They have unexpectedly answered some of the question that I didn't even exist in my mind. Keep up and great work!
@techTFQ
@techTFQ 2 жыл бұрын
Thank you so very much for the amazing feedback :) I am so glad you took the time to comment and so glad you like my contents 🙏
@Risewithvishwas
@Risewithvishwas Жыл бұрын
GREAT EXPLANATION AND IS BETTER THAN OTHER CHARGEABLE INSTITUTIONS
@keifer7813
@keifer7813 2 жыл бұрын
5 minutes in and I already understand more than any other video on this topic. Thanks man
@techTFQ
@techTFQ 2 жыл бұрын
Awesome.. glad this helped
@sowmiyanadarajan8041
@sowmiyanadarajan8041 2 жыл бұрын
believe me.. Now i can able to solve complex queries after following techTFQ. i know still longway to go but i have confidence to solve any kind of questions
@techTFQ
@techTFQ 2 жыл бұрын
Very happy to know that ☺️ Thank you 🙏🏼
@Shillu9999
@Shillu9999 Жыл бұрын
Really Helpful and Very Good to understand SQL especially for Beginners
@rajorshi1000
@rajorshi1000 2 жыл бұрын
Such a wonderful explanation. I was always afraid of using WITH clause but after watching this video, I will definitely try to implement the same wherever it's possible. Thanks a lot brother.
@techTFQ
@techTFQ 2 жыл бұрын
Glad to hear that buddy
@jxon6246
@jxon6246 9 ай бұрын
Really useful video. Spared me a lot of web research and let me understand the principle that enabled me to execute at a way more complex query.
@unpluggedsaurav3186
@unpluggedsaurav3186 2 жыл бұрын
you are a gem sir, as soon as I crack my data analyst, I am gonna donate good part of my first month salary to channel, #gratitude
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Saurav :) Appreciate your generosity. And wishing you all the best
@USA_to_Asia_in_2024
@USA_to_Asia_in_2024 5 ай бұрын
Thank you so much. God is so good as you are a blessing with your lessons.
@divyaaa9956
@divyaaa9956 2 ай бұрын
thanks for explaining everything with this simplicity
@homelessguy4143
@homelessguy4143 2 жыл бұрын
You are the best no one explained with clause better than you.
@techTFQ
@techTFQ 2 жыл бұрын
thank you so much :)
@mullaipugazhendi3236
@mullaipugazhendi3236 Жыл бұрын
CLEAR AND SIMPLE. LOVELY EXPLANATION
@sukh9209
@sukh9209 2 жыл бұрын
Simple and clear explanation for usage of CTE. Thanks
@techTFQ
@techTFQ 2 жыл бұрын
Glad you liked it
@kalyanchakravarthyc-xo6ub
@kalyanchakravarthyc-xo6ub Жыл бұрын
YOU ARE THE BEST TUTOR.
@misterhanwee1030
@misterhanwee1030 Жыл бұрын
Thanks for the generous sharing! Your explanation makes it much easier to grasp than the one i took on Udemy.
@sudhanshukrsingh1928
@sudhanshukrsingh1928 3 жыл бұрын
Never used it. Fantastic proof of concept. Will be using it as a cursor in future.
@techTFQ
@techTFQ 3 жыл бұрын
Thank you Sudhanshu 🙏🏼 Yes it’s a very very useful concept
@ነብስወከፍ
@ነብስወከፍ 2 жыл бұрын
What I mainly like about you is, the project based explanations you provide. Its now making alot of sense to me after watching your videos. Thanks. Please more and more of project based explanation of SQL.
@techTFQ
@techTFQ 2 жыл бұрын
Thank you for the feedback 🙏🏼 So glad to read this ☺️
@lprashanth1251
@lprashanth1251 2 жыл бұрын
It's great to start the SQL learning career with your video's.
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Prashanth.. glad you think so
@sd_d
@sd_d 8 ай бұрын
Im grateful to you beyond words could express Mr.Thoufiq. Big Salute to you
@naren254
@naren254 2 жыл бұрын
you explained in very simple way so it is best video so far I ever seen on SQL.
@programmingintheshadows4456
@programmingintheshadows4456 Жыл бұрын
what i felt about the video ? your a god dude ❤, thats what i felt
@bandiashokyadav3312
@bandiashokyadav3312 4 ай бұрын
Exllent Learning Platform for Advanced SQL
@tonysun203
@tonysun203 2 жыл бұрын
Just like the way you explain the concept so that it is more easier to understand. Thanks again for your video. I have learnt a lot.
@bananaboydan3642
@bananaboydan3642 Жыл бұрын
Best video i have sen for this concept!
@kesiaselestin8110
@kesiaselestin8110 2 жыл бұрын
You have made it so easy to understand the with clause. Thank You!
@techTFQ
@techTFQ 2 жыл бұрын
Your welcome 🙏🏼 Glad this helped
@SagarKumar-db2xy
@SagarKumar-db2xy 3 жыл бұрын
Damn, best and underrated channel I have seen till now. Crisp, to the point and just useful information...
@techTFQ
@techTFQ 3 жыл бұрын
Thank you Sagar once again for all the support and always liking my content 🙏🏼 Am so glad, I am able to add some value through these videos 🙂
@mayurshinde7443
@mayurshinde7443 2 жыл бұрын
Best video!!!! 100x better than all univ professors combined! Such a clear cut explanation!
@techTFQ
@techTFQ 2 жыл бұрын
Glad you liked it
@chikotty
@chikotty 2 жыл бұрын
By far the best material I ever met. Thank you!
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Coma. glad you liked it :)
@engalibadouin5222
@engalibadouin5222 3 жыл бұрын
thanx techTFQ for your simplicity.
@techTFQ
@techTFQ 3 жыл бұрын
Thank you bro 🙏🏼 Glad you liked it 🙂
@arjuntantry7894
@arjuntantry7894 Жыл бұрын
Bro You're an Amazing Teacher. Nobody ever could make learning SQL so simple!. Thank You!
@pzuazu8636
@pzuazu8636 2 жыл бұрын
Thank you for your brilliant examples and explanations, you are doing an excellent job.
@techTFQ
@techTFQ 2 жыл бұрын
Thank you so much 🙏🏼 Happy to know this helped you
@madhubhadrapura8652
@madhubhadrapura8652 26 күн бұрын
Thank you for very detailed explanation
@mohammedshahil4898
@mohammedshahil4898 3 жыл бұрын
Was always feeling quite hard to get hold of this With clause. Thanks a lot for making it so easy to understand✌️ As usual loved the way you explained the whole thing🙌🏻
@techTFQ
@techTFQ 3 жыл бұрын
Thank you bro ❤️❤️❤️
@nibinjoseph3725
@nibinjoseph3725 2 жыл бұрын
Everytime I watch your videos I get tempted to subscribe the channel, later making me feel sad that am already subscribed. Is there anyone here who feel crazy like this ?
@techTFQ
@techTFQ 2 жыл бұрын
haha awesome Nibin :D Thanks a lot
@saipradyumna9371
@saipradyumna9371 Жыл бұрын
Your SQL YT videos has helped me a lot, thank you
@AbdelkrimJa
@AbdelkrimJa 2 жыл бұрын
Thank you very much for this simple and informative course. it helped me solve part of my problem with a database. I am still trying to complete my query of statistics.
@techTFQ
@techTFQ 2 жыл бұрын
I am glad to hear that bro
@rajnishpsinha4683
@rajnishpsinha4683 2 жыл бұрын
With query has been clearly explained, thanks for this video
@techTFQ
@techTFQ 2 жыл бұрын
Glad you liked it
@anaskhan4841
@anaskhan4841 2 жыл бұрын
Your videos are next level. I couldn't find this quality even in paid courses on udemy
@techTFQ
@techTFQ 2 жыл бұрын
Thank you very much Anas 🙏🏼
@swarnalathak88
@swarnalathak88 Жыл бұрын
GRATITUDE for all the videos in sql complex queries.
@balsciviltrekking860
@balsciviltrekking860 Жыл бұрын
its very useful sir, explanation are very clear and understanging easily
@ВсеволодПушкарев-й3у
@ВсеволодПушкарев-й3у 3 жыл бұрын
thx for the videos, they really help to understand how sql querries could be written!
@techTFQ
@techTFQ 3 жыл бұрын
Thank you 🙏🏼 Glad this helped
@sripadapalai
@sripadapalai Жыл бұрын
sir u are great,ur learning procedure awasome
@harcharansingh1997
@harcharansingh1997 3 жыл бұрын
Sir plzzz bring more videos like this , your voice has tone that helped me lot . Thank you so much
@techTFQ
@techTFQ 3 жыл бұрын
Thank you Harcharan 🙏🏼 Glad to know my voice is clear enough ☺️☺️ Will make more videos
@amukeshkumar7921
@amukeshkumar7921 2 жыл бұрын
your tutorial helped me a lot thank you so much
@techTFQ
@techTFQ 2 жыл бұрын
Your welcome buddy
@zonziriguekonate1066
@zonziriguekonate1066 2 жыл бұрын
Thank you so much for this course. powerful 👍
@bapanbairagya9642
@bapanbairagya9642 2 жыл бұрын
Great Lecture Sir
@becharoussama4676
@becharoussama4676 Жыл бұрын
Best One to show how really CTEs work and the difference between them and subqueries. Nice Job
@techTFQ
@techTFQ 11 ай бұрын
thank you
@otherside17
@otherside17 2 жыл бұрын
شكراً جزيلا أخ توفيق . بارك الله بك
@techTFQ
@techTFQ 2 жыл бұрын
Your welcome brother
@StrangerBaba86
@StrangerBaba86 2 жыл бұрын
Excellent.. using cte also get rid of temp tables or reference tables..also bear in mind that memory should be enough to hold data .. since it's being referenced later.
@lalithag6511
@lalithag6511 2 жыл бұрын
Thank you. You explained very clearly and also in detail at the same time. Glad I found this video.
@qianli2696
@qianli2696 9 ай бұрын
Thank you for providing the helpful sql video.
@RohithS-ig4hl
@RohithS-ig4hl Жыл бұрын
Really an excellent way to explain with clause. Thank you for this!
@shobanaathiappan4275
@shobanaathiappan4275 2 жыл бұрын
Stick to sql only please, please be specialised teacher for sql. Dont mess it up with other items. Just related to queries and data managements. You have teach me something very important in very simple way. Thank you so much!
@techTFQ
@techTFQ 2 жыл бұрын
Noted and thank you 🙏🏼
@wintermorillo6567
@wintermorillo6567 2 жыл бұрын
Thank you very much for the explanation, everything was very clear, I have seen it before, but it was very interesting watching this video and getting a detailed example to get a better understanding.
@techTFQ
@techTFQ 2 жыл бұрын
Glad it was helpful!
@asmacollectiononlineshoppi6341
@asmacollectiononlineshoppi6341 2 жыл бұрын
Explain everything so clearly with all of the explanation that helped a lot to understand the concepts Better. Thanks a lot for such valuable videos.👍
@techTFQ
@techTFQ 2 жыл бұрын
Your welcome Asma Glad this helped
@Peak_Ideas
@Peak_Ideas Жыл бұрын
Thanks for such a clear explanation.
@menakurusandeep9444
@menakurusandeep9444 2 жыл бұрын
please make videos in more advanced concepts in sql. your explanation is very straight and easy to understand. many thanks for this video.
@techTFQ
@techTFQ 2 жыл бұрын
Your welcome 🙏🏼 and I have already posted some videos covering advance concepts and will be doing more in the near future too
@railbatyrshin377
@railbatyrshin377 Жыл бұрын
Thank you sir, I understand common things, but I need more practice to improve the information that I got from this video, It's complex for me. Very useful video.
@krish_for_you
@krish_for_you 10 ай бұрын
Really thanks bro, your explanation is awesome, It is like a spoon feeding to a born baby.
@varunsawhney8
@varunsawhney8 2 жыл бұрын
Great Work is simplifying complex things simpler. Thank You for doing that. Best wishes...
@techTFQ
@techTFQ 2 жыл бұрын
Your welcome 🙏🏼
@timnewby1546
@timnewby1546 2 жыл бұрын
Nice simple explanation - thank you!
@techTFQ
@techTFQ 2 жыл бұрын
You're welcome!
@blindhydra
@blindhydra 3 жыл бұрын
Thanks for the video, needed to understand this for my job. Very well explained and the way you give the lecture is excellent!
@techTFQ
@techTFQ 3 жыл бұрын
Thank you so much 🙏🏼 Glad you liked it..
@ashishmhatre2846
@ashishmhatre2846 2 жыл бұрын
Please continue doing this ! Great tutorial Thank you so much !!
@techTFQ
@techTFQ 2 жыл бұрын
Your welcome Ashish Glad this helped
@KSudS_
@KSudS_ 3 жыл бұрын
THANK YOU! I want be a guru like you.
@techTFQ
@techTFQ 3 жыл бұрын
Thank you Sudor 🙏🏼 Am not a guru bro 😃 With practice you can also tackle SQL queries with ease.. keep practicing 👍
@mrashid18
@mrashid18 2 жыл бұрын
Well explained and easy to understand. Thank you
@learn_ai_with_us
@learn_ai_with_us 2 жыл бұрын
thanks toufiq..you explain it in detail...
@techTFQ
@techTFQ 2 жыл бұрын
Thank you bro
@lesptitsoiseaux
@lesptitsoiseaux Жыл бұрын
Greetings from Vancouver :) Big thank you for this video. As a fintec product manager who uses metabase and its wisiwig (scratch for sql), I was limited severely in what I could do (I know some sql but didn't know this). Your video here finally explains how to create variables, I mean, cte or datasets to work with. I'm binge watching your channel now! Cheers and happy new year to you and yours.
@jimneuburger3110
@jimneuburger3110 2 жыл бұрын
very straightforward. thank you.
@techTFQ
@techTFQ 2 жыл бұрын
You’re welcome 🙏🏼 Glad you liked it
@Harishkumar-sb3zz
@Harishkumar-sb3zz 2 жыл бұрын
your videos are super. thank you so much. As you're voice is fast, it is bit difficult to make a note of them at the same time. I had to pass the video multiple times and make a note of them, but instead of all that, it would be much better if you could please show a slide in the video itself about the adv/disadv or differences if there are any, so that we can directly make a note of them as per your wordings in the slide. Once again, thank you so much and don't stop making more videos. You're on an online guru for us ...🙏
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Harish for your kind feedback 🙏🏼 I am glad this helped you and I’ll try to get slower as much as possible
@pritompaul4249
@pritompaul4249 2 жыл бұрын
You're the best SQL instructor in KZbin. Hoping for the best and keep up this mighty work.
@kavitajoshi5089
@kavitajoshi5089 2 жыл бұрын
Thank You for this video...very well explained
@techTFQ
@techTFQ 2 жыл бұрын
Glad you liked it
@hansikahettige2983
@hansikahettige2983 2 жыл бұрын
Thank your video, Such a wonderful explanation
@techTFQ
@techTFQ 2 жыл бұрын
Glad you liked it
@RiPp1er
@RiPp1er Жыл бұрын
Nice explanation of CTEs!
@AkashPremaraj
@AkashPremaraj 2 жыл бұрын
What an explanation 🔥 This is the most simplest explanation I have ever seen in my career. Thank You so much ❤️ Please make a video on table indexes!
@techTFQ
@techTFQ 2 жыл бұрын
Thank you Akash 🙏🏼 Glad you liked it .. Will consider a video on index in the near future
@govindmall4731
@govindmall4731 Жыл бұрын
@@techTFQ yes please...
@marjantabalya
@marjantabalya 2 жыл бұрын
Many thanks to you ... you made it very simple and precise to understand. Hope we can get the recursive explanation too.
@techTFQ
@techTFQ 2 жыл бұрын
Glad it helped.. and yes will cover recursive queries soon
@ctnrandhawa7019
@ctnrandhawa7019 2 жыл бұрын
Your way of teaching and explaining is too good and helpful. keep it up
@LalithammaBestavaripeta
@LalithammaBestavaripeta Жыл бұрын
Thanks for explaining the concepts from a very basic. It really helped me to understand easily.
SQL Views Tutorial | VIEWS in SQL Complete Tutorial
43:20
techTFQ
Рет қаралды 288 М.
What type of pedestrian are you?😄 #tiktok #elsarca
00:28
Elsa Arca
Рет қаралды 33 МЛН
Муж внезапно вернулся домой @Oscar_elteacher
00:43
История одного вокалиста
Рет қаралды 6 МЛН
Solving SQL Query | Rows to Column in SQL
1:13:11
techTFQ
Рет қаралды 177 М.
What type of pedestrian are you?😄 #tiktok #elsarca
00:28
Elsa Arca
Рет қаралды 33 МЛН