|The jOOQ User Manual : SQL building : SQL Statements (DDL) : The CREATE statement : CREATE TABLE||previous : next|
Applies to ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
Arguably the most used DDL statement is the
CREATE TABLE statement.
There are a few overloads to achieve the same thing with different types of parameters, as always. To keep things simple, only one example is given.
// Create a new table with a column create.createTable("table") .column("column1", INTEGER) .execute();
Occasionally, creating a table from a SELECT statement is very useful, copying the source table's data types and data.
// Create a new table from a source SELECT statement create.createTable("book_archive") .as(select(BOOK.ID, BOOK.TITLE).from(BOOK)) .execute();