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 also learned aggregate functions such as SUM
, AVG
, and COUNT
in Chapter 4, Aggregate Functions for Data Analysis. These functions receive data from a dataset of multiple rows and produce a result for this dataset. Both types of functions are useful in different scenarios. For example, if you have the physical checkup results of all newborn babies in a country, such as weight and height, you can check each baby's health by checking these measurements to be within a given range using CASE WHEN
function. You can also use aggregate functions to get the average and standard deviation of the weight and height of babies in this country. Both types...