A Hidden Benefit of Implicit Joins: Join Elimination
One of jOOQ's key features so far has always been to render pretty much exactly the SQL that users expect, without any surprises - unless some emulation is required to make a query work, of course....
View ArticleAn Efficient Way to Check for Existence of Multiple Values in SQL
In a previous blog post, we've advertised the use of SQL EXISTS rather than COUNT(*) to check for existence of a value in SQL. I.e. to check if in the Sakila database, actors called WAHLBERG have...
View ArticleGetting Top 1 Values Per Group in Oracle
I've blogged about generic ways of getting top 1 or top n per category queries before on this blog. An Oracle specific version in that post used the arcane KEEP syntax: SELECT max(actor_id) KEEP...
View ArticleEmulating SQL FILTER with Oracle JSON Aggregate Functions
A cool standard SQL:2003 feature is the aggregate FILTER clause, which is supported natively by at least these RDBMS: ClickHouse CockroachDB DuckDB Firebird H2 HSQLDB PostgreSQL SQLite Trino YugabyteDB...
View ArticleThink About SQL MERGE in Terms of a RIGHT JOIN
RIGHT JOIN is an esoteric feature in the SQL language, and hardly ever seen in the real world, because almost every RIGHT JOIN can just be expressed as an equivalent LEFT JOIN. The following two...
View ArticleWhen SQL Meets Lambda Expressions
ARRAY types are a part of the ISO/IEC 9075 SQL standard. The standard specifies how to: Construct arrays Nest data into arrays (e.g. by means of aggregation or subqueries) Unnest data from arrays into...
View Article