Example: INSERT and Queue Tables - Analytics Database - Teradata Vantage

SQL Data Manipulation Language

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2024-12-13
dita:mapPath
pon1628111750298.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
esx1472246586715
lifecycle
latest
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;