From the course: PostgreSQL: Advanced Queries

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Evaluate probability with cumulative distribution

Evaluate probability with cumulative distribution - PostgreSQL Tutorial

From the course: PostgreSQL: Advanced Queries

Evaluate probability with cumulative distribution

- [Instructor] There's one additional ranking function that we should take a look at before wrapping up this chapter. It's called cumulative distribution, and it's almost identical to the percent rank function, except for one small detail. Let's take a look at the result of both functions side by side. I'll start with the same name, gender, and height inches column from the People Heights table. I'll also add in the same percent rank function that we used in the prior movie. Next, I'll add in the cumulative distribution function, which is abbreviated as cume_dist. This function works exactly the same as percent rank. It uses the same over clause and the same order by statement. Finally, I'll add an order by clause to the very end of the query to sort the height values descending. Okay, let's execute the query, and we'll take a close look at the results. You can see that these two columns return numbers that are very…

Contents