Example: Dropping a Column from a Column Partition Which Also Drops the Partition - Teradata VantageCloud Lake

Lake - Working with SQL

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2025-11-21
dita:mapPath
jbe1714339405530.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
jbe1714339405530

This statement drops a column from a column partition. Because the dropped column is the last column in the partition, the statement also drops the partition.

     ALTER TABLE orders 
     DROP o_comment_ext1;

Resulting table definition:

     CREATE TABLE orders (
       o_orderkey       INTEGER NOT NULL,
       o_custkey        INTEGER,
       o_orderstatus    CHARACTER(1) CASESPECIFIC,
       o_totalprice     DECIMAL(13,2) NOT NULL,
       o_ordertsz       TIMESTAMP(6) WITH TIME ZONE NOT NULL,
       o_salesperson    VARCHAR(5),
       o_ordersubstatus CHARACTER(1) CASESPECIFIC,
       o_ship_addr      VARCHAR(500),
       o_bill_addr      VARCHAR(200),
       o_alt_ship_addr  VARCHAR(500),
       o_alt_bill_addr  VARCHAR(200),
       o_item_count     INTEGER )
     PARTITION BY (COLUMN ALL BUT ( (o_orderstatus, o_ordersubstatus),
                        ROW(o_ship_addr, o_bill_addr) NO AUTO COMPRESS,
                        COLUMN(o_alt_ship_addr, o_alt_bill_addr)) ADD 2,
                   RANGE_N(o_ordertsz 
                   BETWEEN TIMESTAMP '2003-01-01 00:00:00.000000+00:00'
                   AND     TIMESTAMP '2009-12-31 23:59:59.999999+00:00' 
                   EACH INTERVAL '1' MONTH) ),
     UNIQUE INDEX(o_orderkey);

The ADD option value for level 1 increases to 2.