About

Monday, June 3, 2024

Emulating 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: The following aggregate function computes the number of rows per group which satifsy the FILTER clause: This is useful for pivot style queries, where multiple aggregate values are computed in one go. For most basic types … Continue reading Emulating SQL FILTER with Oracle JSON Aggregate Functions

from Java, SQL and jOOQ. https://ift.tt/kKnEpDL
via IFTTT

Friday, March 1, 2024

Getting 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: This is a bit difficult to read when you see it for the first time. Think of it as a complicated way to say … Continue reading Getting Top 1 Values Per Group in Oracle

from Java, SQL and jOOQ. https://ift.tt/ACY2KP9
via IFTTT

Friday, February 16, 2024

An 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 played in any films, instead of: Do this: (Depending on your dialect you may require a FROM DUAL clause, … Continue reading An Efficient Way to Check for Existence of Multiple Values in SQL

from Java, SQL and jOOQ. https://ift.tt/0wPS1iX
via IFTTT

Wednesday, January 10, 2024

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. This means that while join elimination is a powerful feature of many RDBMS, it isn’t part of jOOQ’s feature … Continue reading A Hidden Benefit of Implicit Joins: Join Elimination

from Java, SQL and jOOQ. https://ift.tt/f8IBVbx
via IFTTT

Friday, December 29, 2023

jOOQ 3.19’s new Explicit and Implicit to-many path joins

jOOQ 3.19 finally delivers on a set of features that will greatly simplify your queries further, after jOOQ 3.11 introduced implicit to-one joins: What are these features? Many ORMs (e.g. JPA, Doctrine, jOOQ 3.11 and others) support “path joins” (they may have different names for this concept). A path join is a join derived from … Continue reading jOOQ 3.19’s new Explicit and Implicit to-many path joins

from Java, SQL and jOOQ. https://ift.tt/VXPsEDy
via IFTTT