# How to Write a Derived Table in jOOQ

DevFeed: [How to Write a Derived Table in jOOQ](<https://devfeed.tech/articles/how-to-write-a-derived-table-in-jooq-28948.md>)

Original publisher: [Read original article](<https://blog.jooq.org/how-to-write-a-derived-table-in-jooq/>)

Author: lukaseder

Published: 2023-02-24T09:18:48Z

Content type: tutorial

Language: en

Sources: [jOOQ](<https://devfeed.tech/sources/jooq.md>)

Topics: [SQL](<https://devfeed.tech/topics/sql.md>), [Java](<https://devfeed.tech/topics/java.md>), [Databases](<https://devfeed.tech/topics/databases.md>)

Tags: [cte](<https://devfeed.tech/tags/cte.md>), [derived-table](<https://devfeed.tech/tags/derived-table.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [jooq](<https://devfeed.tech/tags/jooq.md>), [jooq-in-use](<https://devfeed.tech/tags/jooq-in-use.md>), [sql](<https://devfeed.tech/tags/sql.md>), [type-safety](<https://devfeed.tech/tags/type-safety.md>)

## AI overview

This tutorial explains how to write derived tables and common table expressions in jOOQ. It notes that derived-table columns are not fully type-safe in Java, and shows that simplifying an SQL query can sometimes eliminate the derived table and allow greater use of generated code.

## Source excerpt

One of the more frequent questions about jOOQ is how to write a derived table (or a CTE). The jOOQ manual shows a simple example of a derived table: In SQL: In jOOQ: And that's pretty much it. The question usually arises from the fact that there's a surprising lack of type safety when working ... Continue reading How to Write a Derived Table in jOOQ ->