23.9. Multivariable Descriptive Statistics in SQL

More and more SQL products are adding more complicated descriptive statistics to their aggregate function library. For example, CA-Ingres comes with a very nice set of such tools.

Many of the single-column aggregate functions for which we just gave code are built-in functions. If you have that advantage, then use them. They will have corrections for floating-point rounding errors and be more accurate.

Descriptive statistics are not all single-column computations. You often want to know relationships among several variables for prediction and description. Let’s pick one statistic that is representative of this class of functions and see what problems we have writing our own aggregate function ...

Get Joe Celko's SQL for Smarties, 3rd 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.