From the course: Advanced SQL – Window Functions

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

The concept of rank

The concept of rank - SQL Tutorial

From the course: Advanced SQL – Window Functions

Start my 1-month free trial

The concept of rank

- [Instructor] Ranks define a relationship between a set of elements. So that's for any two elements, we can state that one is ranked higher, lower, or the same as any other. In mathematics it is called a weak order or a total preorder of elements. Reducing or simplifying a set of attributes to a numeric sequence or ratio is extremely useful for evaluating complex datasets. The ANSI SQL standard defines two window functions in the Rank category, RANK and DENSE_RANK. I've decided to include two more functions for this chapter, even though they're not considered by ANSI to be true Rank functions. These are ROW_NUMBER and NTILE. The ANSI standard defines each as a category in itself. From now on when I'll use the term Rank functions, remember I refer to all four. Partitioning is optional for Rank functions. The first major difference between Rank window functions and Aggregate window functions is their use of the ORDER BY…

Contents