CREATE TABLE Examples | Teradata Vantage - 17.10 - Example: Creating a Simple Queue Table - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1144-171K
Language
English (United States)

This example creates a simple queue table.

The first column defined for the table is the Query Insertion Timestamp (QITS) column. This is mandatory for all queue tables.

The QITS column must be defined with a timestamp data type with exactly the same precision and default value as specified in the example. You do not need to specify a precision for the TIMESTAMP data type specification because it defaults to 6 when no precision is specified. You cannot explicitly specify a precision other than 6 for the timestamp. This is mandatory for queue tables.

The QITS column is not the (nonunique) primary index for the table.

       CREATE SET TABLE qtbl_1, QUEUE, FALLBACK, 
       NO BEFORE JOURNAL,
       NO AFTER JOURNAL (
        col_1 TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
        col_2 INTEGER,
        col_3 INTEGER)
       PRIMARY INDEX (col_2, col_3);