CUME_DIST analytic function in SQL Server - #1 #SQLServer #CUMEDIST #SQLAnalytics #DataAnalysis

preview_player
Показать описание
#SQLServer #CUMEDIST #SQLAnalytics #DataAnalysis #TSQL #SQLFunctions #DataScience #Database #SQLQuery #SQLTips #DataEngineering #BigData #Analytics #SQLServer2019 #SQLServer2022 #TechTips #Programming #DataVisualization #BusinessIntelligence #SQLPerformance

------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------

QUERY SOLVE -
1. Analytic functions in SQL Server
2. CUME_DIST analytic functions in SQL Server
3. Syntax of CUME_DIST analytic functions
4. partition by clause in SQL Server
5. Order by clause in SQL Server
6. Default parameters of CUME_DIST analytic functions in SQL Server

CUME_DIST ()
As per SQL Server Official Documentation, the CUME_DIST function is used to find the cumulative distribution of value among the group of values. Simply speaking, the cumulative distribution value for a row can be calculated by dividing the row number (as defined by the ORDER BY clause) by the
total number of rows in the group.
The range of values returned by CUME_DIST is greater than 0.0 and less than or equal to 1.0

Syntax :
CUME_DIST( ) OVER ( [ partition_by_clause ] order_by_clause )

Formula :
CUME_DIST( ) = (RowNo / TotalRows)

QUERY :
CREATE TABLE SCRIPT -
----------------------------------------
CREATE TABLE [dbo].[Bikes](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Name] [varchar](100) NULL,
[Make] [varchar](100) NULL,
[Model] [int] NULL,
[Price] [int] NULL,
[Type] [varchar](20) NULL,
PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO

-----CUME_DIST() - ANALYTIC FUNCTION QUERY
-----------------------------------------------------------------------------
SELECT [Name],
Make,
Model,
Price,
[Type],
CUME_DIST () over (PARTITION BY [TYPE] ORDER BY price) as CUME_DIST
FROM [Bikes]

Thanks for watching this video
Рекомендации по теме
Комментарии
Автор

Can you please give realtime scenario when we use in realtime

vakfunnyfactstelugu
Автор

sir ye btao job m ya in
terview kese aaayega iska question analytical function k upar koi interview series ya interview question btaye ya vdo daale

satvikchauhan
Автор

Very well explained, just the video wasn't clear.

shankarnarayananiyer
Автор

Hi, thank you for the video. Could you share me the information's script, please? i would like insert the information in my table on my database

memo
Автор

Hi Thanks for this video..
Plz help me to understand in working life where we can use it...

gauravtambe
visit shbcf.ru