Available in versions: Dev (3.20) | Latest (3.19) | 3.18 | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11 | 3.10

Temporary tables

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

Many dialects support different notions of "temporary" tables, i.e. tables whose data and/or meta data is stored only temporarily. The details of these temporary are implementation specific. jOOQ supports the following syntaxes, both with explicit column lists or as CREATE TABLE AS SELECT:

// Create a new temporary table
create.createTemporaryTable("book_archive")
      .column("column1", INTEGER)
      .execute();

// Create a new temporary table
create.createGlobalTemporaryTable("book_archive")
      .column("column1", INTEGER)
      .execute();

Dialect support

This example using jOOQ:

createTemporaryTable("book_archive")
      .column("column1", INTEGER)

Translates to the following dialect specific expressions:

Aurora MySQL, Aurora Postgres, DuckDB, MariaDB, MemSQL, MySQL, Postgres, Redshift, YugabyteDB

CREATE TEMPORARY TABLE book_archive (
  column1 int
)

BigQuery

CREATE TEMPORARY TABLE book_archive (
  column1 int64
)

ClickHouse

CREATE TEMPORARY TABLE book_archive (
  column1 Nullable(integer)
)
ENGINE Log()

CockroachDB

CREATE GLOBAL TEMPORARY TABLE book_archive (
  column1 int4
)

Firebird, Hana, Teradata

CREATE GLOBAL TEMPORARY TABLE book_archive (
  column1 integer
)

Oracle, Snowflake

CREATE GLOBAL TEMPORARY TABLE book_archive (
  column1 number(10)
)

Vertica

CREATE GLOBAL TEMPORARY TABLE book_archive (
  column1 int
)

ASE, Access, DB2, Derby, Exasol, H2, HSQLDB, Informix, SQLDataWarehouse, SQLServer, SQLite, Sybase, Trino

/* UNSUPPORTED */
Generated with jOOQ 3.20. Translate your own SQL on our website

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo