~/devreads

#cartesian product

3 posts

21 Jun 2023

vladmihalcea 1 min read

Introduction In this article, we are going to see how we can fetch multiple to-many relationships with jOOQ MULTISET so that we avoid bumping into an unintentional Cartesian Product. The approach taken by jOOQ is truly revolutionary since it offers a solution that allows you to fetch multiple to-many relationships using a single type-safe query. Domain Model Let’s assume that…

jooqcartesian productjoinmany-to-manymultiple

9 Mar 2016

lukaseder 1 min read

A lot of developers get the distinction between JOIN and SEMI-JOIN wrong. Let me explain… What are JOIN and SEMI-JOIN A little bit of relational algebra first. What is an (INNER) JOIN? An JOIN is nothing but a filtered cartesian product. And what is a cartesian product? Wikipedia explains this very nicely: for sets A … Continue reading SQL JOIN…

sqlcartesian productcross joincross productexists

6 Oct 2015

lukaseder 1 min read

When people talk about SQL JOIN, they often use Venn Diagrams to illustrate inclusion and exclusion of the two joined sets: While these Venn diagrams are certainly useful to understand (and remember) SQL JOIN syntax, they’re not entirely accurate, because SQL JOIN is a special type of a cartesian product, the CROSS JOIN. In a … Continue reading You Probably…

sqlcartesian productexceptintersectjoin