Problem Statement
Which pair are window ranking distribution functions useful for relative standing?
Explanation
CUME_DIST returns a value from greater than 0 to 1 that shows the cumulative distribution position. NTILE splits ordered rows into a fixed number of buckets like quartiles or deciles.
They are handy for percentile-style reporting, leaderboards, and customer segmentation without collapsing rows.
Code Solution
SolutionRead Only
SELECT user_id, spend,
CUME_DIST() OVER (ORDER BY spend) AS cd,
NTILE(4) OVER (ORDER BY spend) AS quartile
FROM users_spend;