Example: INSERT and Queue Tables - Teradata Database - Teradata Vantage NewSQL Engine

SQL Data Manipulation Language

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
March 2019
Language
English (United States)
Last Update
2019-05-03
dita:mapPath
fbo1512081269404.ditamap
dita:ditavalPath
TD_DBS_16_20_Update1.ditaval
dita:id
B035-1146
lifecycle
previous
Product Category
Teradata Vantage™

The following request populates a queue table with values from a base table. The value for the QITS column of the queue table is the default timestamp.

     INSERT INTO orders_qt (productid, quantity, unitprice)
     SELECT productid, quantity, unitprice
     FROM backorders
     WHERE ordernumber = 1002003;

The following request performs a FIFO pop on the orders_qt queue table and stores it into the backorders base table:

     INSERT INTO backorders (productid, quantity, unitprice)
     SELECT AND CONSUME TOP 1 productid, quantity, unitprice
     FROM orders_qt;