Ask Your Question
3

What is the method for obtaining the cume_dist (or percentile) of a value from one column in a different column?

asked 2023-02-16 11:00:00 +0000

huitzilopochtli gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-09-04 02:00:00 +0000

scrum gravatar image

The method for obtaining the cume_dist (or percentile) of a value from one column in a different column is to use the OVER() clause with a PARTITION BY statement. This involves the following syntax:

SELECT column1, column2, cumedist() OVER(PARTITION BY column1 ORDER BY column2) as percentile FROM tablename;

In this syntax, "column1" represents the column containing the values for which you want to calculate the percentile, "column2" represents the column containing the values that will be used to order the percentile calculations, and "tablename" represents the name of the table containing both columns. The cumedist() function is used to calculate the cumulative distribution of the percentile values.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-02-16 11:00:00 +0000

Seen: 10 times

Last updated: Sep 04 '21