Example: INSERT … SELECT and DELETE Operations from a Row-Partitioned Table Using the PARTITION Column as a Search Condition - 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™

This example performs an INSERT … SELECT to copy orders from partitions 1 and 2 of the SLPPI orders table into the old_orders table using the system-defined PARTITION column as a search condition, and then deletes them from orders in the second part of the multistatement request.

     INSERT INTO old_orders
     SELECT *
     FROM orders
     WHERE orders.PARTITION IN (1,2)
    ;DELETE FROM orders
     WHERE orders.PARTITION IN (1,2);