If you want to see more videos like this, Subscribe for more data tutorials like this :) bit.ly/3GiCVUE ⏱ TIMESTAMPS ⏱ --------------------------------- 00:00 Intro 00:00:28 What are Window Ranking Functions? 00:05:48 ROW_NUMBER 00:10:13 RANK 00:14:18 DENSE_RANK 00:18:42 ROW_NUMBER vs RANK vs DENSE_RANK 00:19:45 ROW_NUMBER: TOP-N Analysis 00:23:24 ROW_NUMBER: Bottom-N Analysis 00:27:00 ROW_NUMBER: Assign Unique IDs 00:29:47 ROW_NUMBER: Identify Duplicates 00:35:21 NTILE 00:41:41 NTILE: Data Segmentation 00:45:35 NTILE: Equalizing Loads 00:49:02 Intro Percentage Based Ranking 00:50:10 CUME_DIST 00:53:52 PERCENT_RANK 01:01:40 Summary Enjoy ☕
This is definitely the clearest explanation of any tutorial I've ever seen, and I fell in love with this way of thinking analytically, thank you so much for the tutorial. By the way, what software do you use to do these visual explanations, and I also want to learn this way to understand complex problems in depth.
Hi Baraa, You have made learning so easy and fun. Thank you so much for all the guidance. Can you please make videos on query optimization, tuning, indexation as well please.
I really feel blessed that you made this all video. It's really interesting and easy to understand. when the 1st time i watched your video, i am immediately subscribe!! Great Job Baraa!! Thank you
Thank you so much Baraa! Your videos are so helpful. I appreciate the effort you put into them. Can you please do a video on handling different Date types in SQL?
Hi Baraa, I wanted to ask something, if I use three RANK function in a query but partition those by three different expressions, the result is a bit confusing? What is the order of execution and how does it work? Example: SELECT OrderID, OrderDate, ProductID, Sales, RANK() OVER(PARTITION BY ProductID ORDER BY SALES DESC) AS RankSales, RANK() OVER(PARTITION BY OrderID ORDER BY SALES DESC) AS RankSales, DENSE_RANK() OVER(PARTITION BY ProductID ORDER BY SALES DESC) AS DenseRankSales FROM Sales.Orders And Thanks for being the best teacher ever
Thanks for kind words and great question !! Here's an explanation: The key here is to understand that each RANK function operates independently! Based on your query the data will be partitioned three times and sorted three times. For example: RANK() OVER(PARTITION BY ProductID ORDER BY SALES DESC) ranks sales within each product. RANK() OVER(PARTITION BY OrderID ORDER BY SALES DESC) ranks sales within each order. DENSE_RANK() OVER(PARTITION BY ProductID ORDER BY SALES DESC) gives a dense rank within each product. So each one of them will be executed independently. I hope this helps.
ITALY and SQL both are beautiful only by Baraa sir. From sales.orders) t where rank byproduct=1 Above query after bracket the letter t comes. What it mean Thank you sir
Italy is very lovely and amazing culture. The letter t that comes after the closing bracket in your query is an alias for the subquery. In SQL, you can assign an alias to a table or a subquery to simplify references to it in the rest of your query. In SQL Server it is required to give an Alias after each subquery.
If you want to see more videos like this, Subscribe for more data tutorials like this :) bit.ly/3GiCVUE
⏱ TIMESTAMPS ⏱
---------------------------------
00:00 Intro
00:00:28 What are Window Ranking Functions?
00:05:48 ROW_NUMBER
00:10:13 RANK
00:14:18 DENSE_RANK
00:18:42 ROW_NUMBER vs RANK vs DENSE_RANK
00:19:45 ROW_NUMBER: TOP-N Analysis
00:23:24 ROW_NUMBER: Bottom-N Analysis
00:27:00 ROW_NUMBER: Assign Unique IDs
00:29:47 ROW_NUMBER: Identify Duplicates
00:35:21 NTILE
00:41:41 NTILE: Data Segmentation
00:45:35 NTILE: Equalizing Loads
00:49:02 Intro Percentage Based Ranking
00:50:10 CUME_DIST
00:53:52 PERCENT_RANK
01:01:40 Summary
Enjoy ☕
Greatest tutorial on ranking functions across entire internet ever.
Hi Baraa, Hope you are doing well! Baraa you might don't know how much you are helping people like me.Thanks a million
Hi Baraa, you don't realize how amazing your work is! Please, keep it up with the tutorials!! Thanks :)
And you don't realize how awesome you are, when you take time a writing me this nice comment 🙂
I wonder why something like this doesn't have at least hundreds of thousands of views. Thanks for you efforts
With your people like you supporting, maybe my content will reach the others ❤️
I didn’t seen any videos on sql with immense detailed explanations.
Thank you Baraa! very Informative and I was able to crack my SQL interview because of your SQL videos..
Excellent! Great job 👏
Best teacher ever...🎉
Thanks for introducing advance concept Cume_dist(). It is gonna help me in my office work.
Nice, it’s useful function!
This is definitely the clearest explanation of any tutorial I've ever seen, and I fell in love with this way of thinking analytically, thank you so much for the tutorial.
By the way, what software do you use to do these visual explanations, and I also want to learn this way to understand complex problems in depth.
Hi thanks for the kind words, glad you liked it. I am using drawio and procreate
Hi Baraa,
You have made learning so easy and fun. Thank you so much for all the guidance.
Can you please make videos on query optimization, tuning, indexation as well please.
Noted. Glad you like my videos!
I really feel blessed that you made this all video. It's really interesting and easy to understand. when the 1st time i watched your video, i am immediately subscribe!! Great Job Baraa!! Thank you
I am aswell blessed to be able to reach kind people like you, thanks for the support and glad you liked it
Keep doing it bro your explanation makes more sense I bet you.
Thanks
Thanks very much Baraa
I'm starting to get the hang of SQL from you're tutorial lecture Simply Brilliant ❤❤❤
Great to hear!
your teaching style is mind blowing
Thanks dear ✌️
As always I have no word to thank you. God bless u wherever u r.
Thank you so much Baraa! Your videos are so helpful. I appreciate the effort you put into them. Can you please do a video on handling different Date types in SQL?
Thank for the kind words, yes I’ll cover it in my course!
Outstanding! 👏🏻👏🏻👏🏻
Thank you so much!
Thanks Baraa as always!
Awesome,, pls keep making more extraordinary videos
I am excited even before going through the video ….i am sure I m going to enjoy this … Thanqqqqqq
Amazing explanations with the visualization 🐐.
Btw is that Nescafe your super hot coffee ☕ or air purifier🍀
😂😂 my Coffee is CGI
Thank you so much, was waiting for this video eagerly!!!
You are welcome, i hope you will enjoy it !
time to sit and learn
@@OPTIMUSPRIME-q8x good luck hope you enjoy it and don’t forget your coffee:)
Was waiting for this eagerly!❤
Thanks alot
Hi Baraa, I wanted to ask something, if I use three RANK function in a query but partition those by three different expressions, the result is a bit confusing? What is the order of execution and how does it work? Example:
SELECT
OrderID,
OrderDate,
ProductID,
Sales,
RANK() OVER(PARTITION BY ProductID ORDER BY SALES DESC) AS RankSales,
RANK() OVER(PARTITION BY OrderID ORDER BY SALES DESC) AS RankSales,
DENSE_RANK() OVER(PARTITION BY ProductID ORDER BY SALES DESC) AS DenseRankSales
FROM Sales.Orders
And Thanks for being the best teacher ever
Thanks for kind words and great question !!
Here's an explanation:
The key here is to understand that each RANK function operates independently! Based on your query the data will be partitioned three times and sorted three times.
For example:
RANK() OVER(PARTITION BY ProductID ORDER BY SALES DESC) ranks sales within each product.
RANK() OVER(PARTITION BY OrderID ORDER BY SALES DESC) ranks sales within each order.
DENSE_RANK() OVER(PARTITION BY ProductID ORDER BY SALES DESC) gives a dense rank within each product.
So each one of them will be executed independently. I hope this helps.
@@DataWithBaraa Thanks a lot ! Now it's clear.
what is the letter t after the query
Hi Baraa, hope all is well. Question: do you know MySQL and if you do, can you please do a tutorial on it?
Whether all of this work same in MySQL server
ITALY and SQL both are beautiful only by Baraa sir.
From sales.orders) t where rank byproduct=1
Above query after bracket the letter t comes. What it mean
Thank you sir
Italy is very lovely and amazing culture.
The letter t that comes after the closing bracket in your query is an alias for the subquery. In SQL, you can assign an alias to a table or a subquery to simplify references to it in the rest of your query. In SQL Server it is required to give an Alias after each subquery.
@@DataWithBaraa thank you sir