Example: INSERT and Queue Tables - Advanced SQL Engine - Teradata Database

SQL Data Manipulation Language

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
vjt1596846980081.ditamap
dita:ditavalPath
vjt1596846980081.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;