CREATE TABLE ... AS Syntax
SELECT list.
Parameters
The following can be applied to
<select statement> to affect the resulting
table:
Examples
To create a replicated temporary table that is a copy of an existing table, failing if a table with the same name as the target table already exists:CREATE TABLE ... AS (Replicated/Temporary) Example
a, b, c, & d a new
shard key on columns a & b, and an index on column d, replacing a
table with the same name as the target table, if it exists:
CREATE TABLE ... AS (Reshard) Example
a, b, c, & d, preserving the
primary key on a, b, & c, and the foreign key from d; a new
table must be created to match the schema of the old one and then records can be
copied from the old one to the new one:
CREATE TABLE (Preserve Primary Key) Example, DDL Step
CREATE TABLE (Preserve Primary Key) Example, DML Step
This create/insert process is necessary, as neither primary keys nor
foreign keys can be preserved through hints.