15.10 - Table Kind Clause - Teradata Database

Teradata Database SQL Data Definition Language Syntax and Examples

prodname
Teradata Database
vrm_release
15.10
created_date
December 2015
category
Programming Reference
featnum
B035-1144-151K

Duplicate row control.

If you do not specify SET or MULTISET, the default table kind depends on the session mode.

  • In ANSI session mode, the default table kind is MULTISET. Duplicate rows are allowed.
  • In Teradata session mode, the default table kind is SET. Duplicate rows are not allowed.
MULTISET
Duplicate rows are allowed.
If there are uniqueness constraints on any column or set of columns in the table definition, the table cannot have duplicate rows even if you specify MULTISET.
Some client utilities have restrictions with respect to MULTISET tables. See the CREATE TABLE (Table Kind Clause) topic “SET and MULTISET” in SQL Data Definition Language - Detailed Topics, B035-1184.
SET
Duplicate rows are not allowed.
If the only column in the table is its QITS column, then you cannot specify SET. In this case, the table must be defined, either implicitly or explicitly, as MULTISET. See QITS_column_name.

Example: Creating a Multiset Queue Table

This example creates a multiset queue table with constraints defined at the column level:

    CREATE MULTISET TABLE qtbl_3, QUEUE,
     NO BEFORE JOURNAL,
     NO AFTER JOURNAL (
      qits  TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
      col_2 INTEGER,
      col_3 INTEGER CHECK (col_3 > 10))
    PRIMARY INDEX (qits);

This queue table permits duplicate rows. The system uniquely identifies its rows, including duplicates, by their internally-generated ROWID value.