SQL Tutorial - Window Functions - Ranking with Group By
Another fantastic SQL Tutorial brought to you by BeardedDev.
T-SQL Querying
https://www.amazon.com/gp/product/0735685045/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0735685045&linkCode=as2&tag=beardeddev05-20&linkId=e93b0f7483b1fa06aca5a3aec4f7764b
T-SQL Fundamentals
https://www.amazon.com/gp/product/150930200X/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=150930200X&linkCode=as2&tag=beardeddev05-20&linkId=70aa2ffa3e84cab66cb964ca1e9cee62
Microsoft SQL Server 2012 High-Performance T-SQL Using Window Functions
https://www.amazon.com/gp/product/0735658366/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0735658366&linkCode=as2&tag=beardeddev05-20&linkId=b88746aea666c9f98da147e70b4491ca
If you are new to working with Windows Functions check out this video: https://youtu.be/H6OTMoXjNiM
If you want to find out more about the Group By clause and working with aggregate functions check out this video: https://youtu.be/TYD6gWP3jBg
If you are interested in finding out more about ranking functions available in SQL Server check out this video: https://youtu.be/xL7BtCT7ix4
In this tutorial we explore ranking functions as part of Window Functions using the Group By clause within SQL Server.
In this example we go through how to rank customers based on the sum of the orders they have placed with us.
The window function example also covers the difference between using Rank and Dense_Rank.
SQL
SELECT
Sales_Cust_Id
, SUM(Sales_Total) AS Total
FROM dbo.Sales_2
GROUP BY Sales_Cust_Id
ORDER BY Total DESC
SELECT
Sales_Cust_Id
, SUM(Sales_Total) AS Total
, RANK() OVER(ORDER BY SUM(Sales_Total) DESC) AS rnk
, DENSE_RANK() OVER(ORDER BY SUM(Sales_Total) DESC) AS dnse
FROM dbo.Sales_2
GROUP BY Sales_Cust_Id
ORDER BY rnk
Видео SQL Tutorial - Window Functions - Ranking with Group By канала BeardedDev
T-SQL Querying
https://www.amazon.com/gp/product/0735685045/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0735685045&linkCode=as2&tag=beardeddev05-20&linkId=e93b0f7483b1fa06aca5a3aec4f7764b
T-SQL Fundamentals
https://www.amazon.com/gp/product/150930200X/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=150930200X&linkCode=as2&tag=beardeddev05-20&linkId=70aa2ffa3e84cab66cb964ca1e9cee62
Microsoft SQL Server 2012 High-Performance T-SQL Using Window Functions
https://www.amazon.com/gp/product/0735658366/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0735658366&linkCode=as2&tag=beardeddev05-20&linkId=b88746aea666c9f98da147e70b4491ca
If you are new to working with Windows Functions check out this video: https://youtu.be/H6OTMoXjNiM
If you want to find out more about the Group By clause and working with aggregate functions check out this video: https://youtu.be/TYD6gWP3jBg
If you are interested in finding out more about ranking functions available in SQL Server check out this video: https://youtu.be/xL7BtCT7ix4
In this tutorial we explore ranking functions as part of Window Functions using the Group By clause within SQL Server.
In this example we go through how to rank customers based on the sum of the orders they have placed with us.
The window function example also covers the difference between using Rank and Dense_Rank.
SQL
SELECT
Sales_Cust_Id
, SUM(Sales_Total) AS Total
FROM dbo.Sales_2
GROUP BY Sales_Cust_Id
ORDER BY Total DESC
SELECT
Sales_Cust_Id
, SUM(Sales_Total) AS Total
, RANK() OVER(ORDER BY SUM(Sales_Total) DESC) AS rnk
, DENSE_RANK() OVER(ORDER BY SUM(Sales_Total) DESC) AS dnse
FROM dbo.Sales_2
GROUP BY Sales_Cust_Id
ORDER BY rnk
Видео SQL Tutorial - Window Functions - Ranking with Group By канала BeardedDev
Показать
Комментарии отсутствуют
Информация о видео
Другие видео канала
SQL Tutorial - Window Functions - Lag and LeadSQL Tutorial - Show Totals with GROUP BY using OVERSQL Interview Questions - What is the difference between Rank and Dense RankAdvanced Aggregate Functions in SQL (GROUP BY, HAVING vs. WHERE)Advanced Data Science SQL Interview Question [Amazon] (window functions & aliasing)SQL Tutorial - Window Functions - RankingSQL Server interview question :- Explain RowNumber,Partition,Rank and DenseRank ?GROUP BY with HAVING (Introduction to Oracle SQL)SQL Window Functions on Data Science Interviews in 2021 | Asked By Airbnb, Netflix, Twitter, UberAdvanced SQL Tutorial | Temp TablesSQL Tutorial - How to Calculate Rolling TotalsSQL Tutorial - Window Functions - Calculate Running Totals, AveragesHAVING clause and difference with GROUP BY & WHERE clause in SQL statementSQL Tutorial - Creating a sample of dataSQL Tutorial - PIVOTSQL Server video :- Explain aggregate functions,group by clause and having keyword ?Conceptos Básicos de SQL: Agrupar datos con Group byRank and Dense Rank in SQL ServerSQL Tutorial - Window FunctionsPart 1 How to find nth highest salary in sql