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 - SQL Tutorial
From the course: Advanced SQL – Window Functions
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.