SQL WITH Statements (Common Table Expressions - CTE)
HTML-код
- Опубликовано: 8 фев 2020
- Step-by-step tutorial shows you how to use the WITH statement in SQL to create Common Table Expressions (CTE)!
Watch the Subquery video: • How to do Subqueries i...
Get the Northwind Database: • How to Load a Sample P...
Support the Channel:
1) Subscribe: www.becomingads.com/o/youtube
2) DataCamp:
3) Udacity: - Наука
Thank you! This video helped me understand CTEs a little bit better.
You explained it so well and fast I'm now fully prepared for what may come
Simple and easy to understand explanation. It really made understanding the WITH statement so simpler. Thanks much.
Just a small correction, using the with statement makes indeed things easier to read and debug but the program won't be any faster. It's just a thing you should do to help other humans understand your code.
U ROCK. im going through your channel and god you couldnt get less helpful. thanks man
Thank you for the video, very clear, I like the format, it's straightforward and very well explained!
Thanks, mate! Your explanation is very easy to understand.
Dude! thank you for taking the time to break down cte's simplified (subquery >> cte). Bro, you rock!!! 😎🤟
This was excellent - thank you.
Great video! This helped me run a complex query at work. Thanks 😀
This is clearer than my textbook explanation lol thanks for the video!
Your video helped me a lot, thank You my friend!
You are a sensation! Please, keep going :)
Nice man! subscribing....
Greetings from Colombia!
Hi Nathan, thanks for explaining me CTE Objects. It's know very clear to me. Appriciate
Finally!! Whoa! Thanks man.
Thanks a lot for simple explanation
Thanks, easy and straight forward!
ahhh That makes it much clearer. Thank you!
Thanks for the video. I was looking for more info about caching, but noticed (after some reading) that the caching doesn't happen because of the CTE, but instead, it's decided arbitrarily by Postgres. So for instance, either doing subqueries or CTEs might result in the same performance in the end, even though CTEs makes code more readable.
great example and explanation!
Thanks! Liked, Commented and Subscribed!
Super helpful - thanks a bunch!
That was super helpful!
thanks bro, you saved a lot of time
Sweet and simple: thanks!
Thank you for this very useful video!
The way you describe what cte's are made all the difference. It's so simple when you know yhe why for the how.
Best explanation ever!! 👍
Good explanation. God bless you. AMEN.
Very clear, Thank You Sir !
This is great!
Great video!
clear and concise. ty
Hvala puno!
Thankful for your videos - super helpful! Do you have to use a GROUP BY clause when using CTE's?
It's not a requirement but you certainly could
Very helpful..... Love from India
Great explanation
Nice video, thank you
hats off!!
thankyou sir, it really helped me.
Thanks!
conceptual and easy way to describe
Super sir 👍👍👍
what is the difference between cte:s and temp tables? temp tables are only stored temporarly and cant be accessed as an cte?
Excellent explanation . How dose work when you're working with 10 tables and 5 has millions of records in them? Is this viable considering this is all done in memory?
Thanks
In most database systems, the 'name' of the CTE simply references an internal temporary table that is invisible to you (unless you select from it). So, in effect, the results of the CTE will create a temporary table behind the scenes in order to hold the results of the CTE. It is deleted automatically when you go out of scope of the CTE.
Definitely helpful! Thank you for this. Can you also do a video on recursive CTEs?
i know Im kinda off topic but does anyone know a good site to watch new movies online?
@Anthony Edison I use FlixZone. Just google for it =)
@Kameron Deacon yea, I've been watching on FlixZone for since april myself =)
@Kameron Deacon thanks, I signed up and it seems to work =) I really appreciate it !
@Anthony Edison happy to help xD
in the 3rd example nothing changed when you joined another cte. So why did you join them?
hello there, god bless your efforts..I have a simple enquiry as new sql learner.
How are CTEs different from temporary tables?
Thanks for taking care of this.
A temporary table will exist during the entire duration of the session whereas a CTE is a "named result set" that exists for the duration of the statement immediately following it. If you would like to persist the results of the CTE, then use the CTE to populate a temporary table for processing later. Hope this clears things up
How can I union two cte together, there is one sum on a budget, column are exactly the same I have group by , send me video please
I've been studying SQL now for about 6 months....I think the CTEs are really a good place to start but the more knowledge you gain the more you tend to move away from them and use subqueries
Congrats on your learning Larry. Like all tools, CTEs, subqueries and cursors all have their appropriate use cases. While it is true that you could program almost everything using subqueries, other methods (such as CTEs) could be used as well to make your code easier to follow for those coming behind you to maintain it. Like a painting, everyone has their own style and choice of tools 😉
3:29 is the main purpose of CTE : OPTIMISATION
An EXPLAIN of both syntaxe would have revealed it.
Over code simplification, when you need to interprete subqueries results CTEs are way faster than subqueries since de BDD engine build the CTE result (in bdd server memory not cloud lol) ONCE en start with it for interpretation.
I don't understand what the ctdorders have inside...
and, boom!
why did you use "using" in your join statement and not "on"?
You have a crypto channel too?! I have seen your YF vids
Why the pc screen is so blurred?
I didn't think CTE's are stored anywhere... temp tables are
I don't see the point of using WITH for a single query. If you would use the same WITH for multiple queries, I can understand how it helps.
why no disclaimer to be careful/avoid using temp tables
Could you elaborate on why one should be careful using temp tables?
@@paradix847 scope, memory and performance issues. if a temp table isn’t dropped and the client makes another request to the server, the temp table that was not disposed correctly can throw ambiguous errors
@@christiangrundemann9843 Hey that's good to have in mind. Thanks for the explanation.
Cte isn't tepm table. It works like a temp table. That's what I know. So no disclaimer.
Can I pass list of acctnumbers in with and it will traverse through each one of them to fetch acctid from diff table
Thanks! That was very helpful :)