In my previous article, I showed what the very useful percentile functions (also known as inverse distribution functions) can be used for. Unfortunately, these functions are not ubiquitously available in SQL dialects. As of jOOQ 3.11, they are known to work in these dialects: DialectAs aggregate functionAs window functionMariaDB 10.3.3NoYesOracle 18cYesYesPostgreSQL 11YesNoSQL Server 2017NoYesTeradata 16YesNo … Continue reading How to Emulate PERCENTILE_DISC in MySQL and Other RDBMS
Tag: Analytics
How to Calculate Multiple Aggregate Functions in a Single Query
At a customer site, I've recently encountered a report where a programmer needed to count quite a bit of stuff from a single table. The counts all differed in the way they used specific predicates. The report looked roughly like this (as always, I'm using the Sakila database for illustration): -- Total number of films … Continue reading How to Calculate Multiple Aggregate Functions in a Single Query
10 SQL Tricks That You Didn’t Think Were Possible
Listicles like these do work - not only do they attract attention, if the content is also valuable (and in this case it is, trust me), the article format can be extremely entertaining. This article will bring you 10 SQL tricks that many of you might not have thought were possible. The article is a … Continue reading 10 SQL Tricks That You Didn’t Think Were Possible