Derived tables
Have you ever used a nested SELECT (a SELECT in a table expression)? Of course, you have! Then, you've used a so-called derived table having the scope of the statement that creates it. Roughly, a derived table should be treated in the same way as a base table. In other words, it is advisable to give it and its columns meaningful names via the AS operator. This way, you can reference the derived table without ambiguity, and you'll respect the fact that most databases don't support unnamed (unaliased) derived tables.
jOOQ allows us to transform any SELECT in a derived table via asTable(), or its synonym table(). Let's have a simple example starting from this SELECT:
select(inline(1).as("one"));
This is not a derived table, but it can become one as follows (these two are synonyms):
Table<?> t = select(inline(1).as("one")).asTable();
Table<?> t = table(select(inline(1).as("one")));
In jOOQ, we...