Defines the column names, column data types and attributes, primary and secondary indexes, column- and table-constraints, partitioning, and other attributes of a new table. The CREATE TABLE AS form copies column definitions to a new table. Optionally, copies data and statistics to the new table.
- BLOCKCOMPRESSION
- CHECKSUM
- DATABLOCKSIZE
- FREESPACE
- MERGEBLOCKRATIO
The NO FALLBACK attribute is ignored.
The table structure definition is stored in the data dictionary for all table types, except volatile tables. While processing a CREATE TABLE statement, an EXCLUSIVE lock is placed on the table being created.
CREATE TABLE and CREATE TABLE AS do not apply to the following kinds of tables. To create those tables, see the following topics.
Table Kind | |
---|---|
Object File System | CREATE TABLE and CREATE TABLE AS (Object File System Table Form) |
Queue | CREATE TABLE (Queue Table Form) |
Global temporary trace | CREATE GLOBAL TEMPORARY TRACE TABLE |
Foreign | CREATE FOREIGN TABLE |
Error | CREATE ERROR TABLE |
To log batch insert and update errors, you must create an error table for each data table for which you want to track errors.
For information on creating time series tables with a Primary Time Index (PTI), see Teradata Vantage™ - Time Series Tables and Operations, B035-1208.
ANSI Compliance
CREATE TABLE is ANSI SQL:2011-compliant with extensions.
Global temporary tables are ANSI SQL:2011-compliant.
- DECLARE GLOBAL TEMPORARY TABLE
- CREATE TEMP TABLE
- DECLARE GLOBAL TEMPORARY TABLE
Required Privileges
No privileges are required to create, access, modify, or drop volatile tables. For all other table types, you must have the CREATE TABLE privilege on the database or user in which the table is created.
If you specify the JOURNAL option, then you must also have INSERT privilege on the journal table.
You must have the CONSTRAINT ASSIGNMENT privilege to create a table that includes one or more row-level security columns.
Privileges Granted Automatically
No privileges are granted on newly created volatile tables, because no privileges are needed to access the table.
- CREATE TRIGGER
- DELETE
- DROP TABLE
- DROP TRIGGER
- DUMP
- INDEX
- INSERT
- REFERENCES
- RESTORE
- SELECT
- STATISTICS
- UPDATE