CREATE TABLE
Valid in: SQL, ESQL, OpenAPI, ODBC, JDBC, .NET
The CREATE TABLE statement creates a base table.
Note: This statement has additional considerations when used in a distributed environment. For more information, see the Star User Guide.
The CREATE TABLE statement has the following format:
[EXEC SQL] CREATE TABLE table_name
(column_specification {, column_specification }
[WITH with_clause]
The CREATE TABLE...AS SELECT statement (which creates a table and load rows from another table) has the following format:
[EXEC SQL] CREATE TABLE table_name
[(column_name {, column_name})] AS
subselect
{UNION [ALL]
subselect}
[WITH with_clause]
table_name
column_specification
AS
Causes the table that you create to be defined and populated by the subselect.
subselect
WITH with_clause
Specifies Enterprise Access product-specific options. For details,see your Enterprise Access product guide.For an overview of the Enterprise Access product WITH clause, see the chapter "OpenSQL Features."
The CREATE TABLE statement creates a new base table owned by the user who issues the statement. If you use the CREATE TABLE...AS syntax, then the table that you create is a subset of the columns and values in existing tables defined by the subselect.
To ensure application portability, follow every CREATE TABLE statement with a COMMIT statement.
Last modified date: 08/14/2024