
jOOQ Masterclass
By :

By most popular types of JOIN
statements we are referring to CROSS JOIN
, INNER JOIN
, LEFT JOIN
, RIGHT JOIN
, and FULL JOIN
. Let's tackle each of them via the jOOQ DSL API, starting with the most basic type of JOIN
.
CROSS JOIN
is the most basic type of JOIN
that gets materialized in a Cartesian product. Having two tables, A
and B
, the CROSS JOIN
operation between them is represented as A x B
, and practically, it means the combination of every row from A
with every row from B
.
In jOOQ, CROSS JOIN
can be rendered by enlisting the tables in the FROM
clause (non-ANSI JOIN
syntax) or via the crossJoin()
method that renders the CROSS JOIN
keywords (ANSI JOIN
syntax). Here is the first case – let's CROSS JOIN
the OFFICE
and DEPARTMENT
tables:
ctx.select().from(OFFICE, DEPARTMENT).fetch();
Since this query doesn't expose explicitly or clearly, its intention of using CROSS JOIN
is not as friendly as the...