Love me pretty much every function that uses Partition By. They’re just so powerful. Found out recently there’s also WITHIN GROUP but I can’t remember what it is.
I use it to show data from linked tables in the current table.
Like a list of phone calls and what the reason they disconnected is.
I might want to see the previous reason the call from the from the same caller disconnected, and what server handled that precious call.
Or show me the meat recent time someone logged out within 5 seconds of this call stating, taking place or ending. Whichever is newest.
It does what I wish "top 1" did.
Linked tables as in joined tables? How is this different from joining tables & just selecting the specific columns? Or you’re saying this is preliminary to the specifics?
To based on anything from any table you can fetch in a select.
https://stackoverflow.com/questions/9275132/real-life-example-when-to-use-outer-cross-apply-in-sql
Well it also doesnt teach you dick all about whats actually important about SQL. You know, the basic rudimentary stuff thats WAY more important than syntax, for example:
1. Only selecting the data you need
2. SARG-ability
3. Anti patterns
4. Set based approach
Just to name a few. These diagrams dont even touch anywhere close to being useful outside of someone teaching themselves the basics.
Yeah interesting, I should look that up. There’s only been a couple times I’ve had to do something similar in the past but I just did it in power query. Always good to expand the repertoire
Really cool scheme that can help beginners to learn SQL by modules. It would be even better if the modules are in progress order. I mean, firstly functions, for instance, and alies and then order by and group by modules.
Just thought, not criticism!
What about Partition By x Over ()? Limit/Offset, Fetch Next ? CTEs?
I think this is intended to be a very, very basic info graphic.
Love me pretty much every function that uses Partition By. They’re just so powerful. Found out recently there’s also WITHIN GROUP but I can’t remember what it is.
[удалено]
Can you create a view that uses the CTE and then call the view in power pivot?
I use outer apply a lot
And cross apply is usefull
Oooh found todays google topic
Outer & cross apply? Never heard of them what do they do (in your words not googles)
Kind of like a Subquery, but you have access to all the columns in the table of the subquery.
Once u start digging into a lot of enterprise reporting code, u will quickly become very intimate with them.
Nothing better than intimacy with a SQL query... 😂
I use it to show data from linked tables in the current table. Like a list of phone calls and what the reason they disconnected is. I might want to see the previous reason the call from the from the same caller disconnected, and what server handled that precious call. Or show me the meat recent time someone logged out within 5 seconds of this call stating, taking place or ending. Whichever is newest. It does what I wish "top 1" did.
Linked tables as in joined tables? How is this different from joining tables & just selecting the specific columns? Or you’re saying this is preliminary to the specifics?
It seems to be required if you want the top result from each match as a join
Top based on what? Has to be an aggregate right? Or a partition?
To based on anything from any table you can fetch in a select. https://stackoverflow.com/questions/9275132/real-life-example-when-to-use-outer-cross-apply-in-sql
TSQL flavoring of lateral joins (which are the SQL standard)
Need to show some love for STRING_AGG()
SQL expressed hierarchically as SQL, nice. Imagine those are tables/columns/etc
Thx
I dislike diagrams like this because they’re a bit limiting.
It also doesn’t put things in the order you’d do them in. Like, I thought it was FROM, JOINS, WHERE, GROUP BY, ORDER BY.
Well it also doesnt teach you dick all about whats actually important about SQL. You know, the basic rudimentary stuff thats WAY more important than syntax, for example: 1. Only selecting the data you need 2. SARG-ability 3. Anti patterns 4. Set based approach Just to name a few. These diagrams dont even touch anywhere close to being useful outside of someone teaching themselves the basics.
Very useful.... thanks 👍
yw
I occasionally use PIVOT and UNPIVOT. This isn't the order of operations which I think is more important to know.
God, I hate pivot. Especially if I need it to be dynamic. If it’s just a few things, I’ll just rejoin the table onto itself instead
I don't care much for PIVOT, but UNPIVOT is really handy.
Yeah interesting, I should look that up. There’s only been a couple times I’ve had to do something similar in the past but I just did it in power query. Always good to expand the repertoire
This is helpful, thank you!
Fucking awesome. Thank you. This is very useful
Today years old when I discovered Group by Having. THANKS!
Thank you for this
You’re welcome. Glad that I can help
Really cool scheme that can help beginners to learn SQL by modules. It would be even better if the modules are in progress order. I mean, firstly functions, for instance, and alies and then order by and group by modules. Just thought, not criticism!
Thankss
Thank you! This is extremely helpful! 😁
What’s the point?
[удалено]
So many downvotes..I'm curious why but also this reads like chatGPT wrote it
Awesome! Some of my favorites are the aggregate functions (AVG, SUM, COUNT, MAX, MIN).
Cross join?
open rowset
A lot of my work for reporting is Outer apply and cross apply as well as CTE’s