5. Window Functions for Data Analysis

Overview

In this chapter, you will learn the conceptual logic of window functions, write SQL to execute these functions, and modify them using keywords such as PARTITION BY and ORDER BY.

By the end of this chapter, you will be able to apply these functions to gain new insights into data and understand the properties of datasets, such as ranking and percentiles.

Introduction

You have learned simple functions such as CASE WHEN, COALESCE, and NULLIF in Chapter 3, SQL for Data Preparation. These functions receive data from a single row and produce a result for this row. The result of these functions is only determined by the data value in the row and has nothing to do with the dataset it is in. You have ...

Get SQL for Data Analytics - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.