How to do it...

  1. You need to connect to Teradata Database using SQLA or Studio.
  2. We will now execute the ALTER statement on the DOB column by compressing all values and o_total along with a list of repeating values in these columns.
  3. ALTER statement will compresses all values in DOB column:
/*Compressing all column values*/       ALTER TABLE td_cookbook.EMP_SAL 
       ADD DOB DATE COMPRESS ; -- ADD COLUMN_NAME DATATYPE
  1. Next, execute ALTER on the o_total column with a list of repeating values only:
/*Compress list of value*/
       ALTER TABLE td_cookbook.EMP_SAL
       ADD o_total INT COMPRESS (890,90);
  1. Execute SHOW table to check the ddl of the new table and verify that the desired compression has been added to the table definition. Check the following output:

Get Teradata Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.