CREATE TABLE... AS creates a new table from a .
The CREATE TABLE AS statement performs a schema change. For more information about how online schema changes work in CockroachDB, see .
Intended use
Tables created withCREATE TABLE... AS are intended to persist the result of a query for later reuse.
This can be more efficient than a when the following two conditions are met:
- The result of the query is used as-is multiple times.
- The copy needs not be kept up-to-date with the original table over time.
The default rules for apply.
Required privileges
The user must have theCREATE on the parent database.
Synopsis
- Basic
- Expanded
Parameters
Known limitations
The of tables created withCREATE TABLE... AS is not automatically derived from the query results. You must specify new primary keys at table creation. For examples, see .

