15.10 - CREATE TABLE - Teradata Database

Teradata Database SQL Data Definition Language Syntax and Examples

Product
Teradata Database
Release Number
15.10
Release Date
December 2015
Content Type
Programming Reference
Publication ID
B035-1144-151K
Language
English (United States)

Purpose

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, data and statistics are copied to the new table.

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.

For information about global temporary trace tables, see CREATE GLOBAL TEMPORARY TRACE TABLE.

To create queue tables, see CREATE TABLE (Queue Table Form).

To log batch insert and update errors, you must create an error table for each data table for which you want to track errors. See CREATE ERROR TABLE.

For information about temporal tables and temporal syntax, see ANSI Temporal Table Support, B035-1186 and Temporal Table Support, B035-1182.

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.

To access a table that contains UDT columns, you must have at least one of the following privileges.

  • UDTUSAGE on the specified UDT
  • UDTUSAGE on the SYSUDTLIB database
  • UDTTYPE on the SYSUDTLIB database
  • UDTMETHOD on the SYSUDTLIB database

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, since no privileges are needed to access the table.

For other table types, the creator receives all the following privileges WITH GRANT OPTION on the newly created table.

  • CREATE TRIGGER
  • DELETE
  • DROP TABLE
  • DROP TRIGGER
  • DUMP
  • INDEX
  • INSERT
  • REFERENCES
  • RESTORE
  • SELECT
  • STATISTICS
  • UPDATE

Syntax - CREATE TABLE

























Syntax - CREATE TABLE … AS