15.10 - Example: Creating a Join Index With a Character Partitioning Expression - Teradata Database

Teradata Database SQL Data Definition Language Syntax and Examples

prodname
Teradata Database
vrm_release
15.10
created_date
December 2015
category
Programming Reference
featnum
B035-1144-151K

This example creates join index t_cppi with a character partitioning expression. The data type for column j in this example is CHARACTER and the type of column k is INTEGER.

     CREATE JOIN INDEX t_cppi AS
       SELECT j, k
       FROM t1
     PRIMARY INDEX(j)
     PARTITION BY (CASE_N(j BETWEEN 'aaaa' 
                            AND     'bbbb',
                          j BETWEEN 'cccc' 
                            AND     'dddd'),
                  RANGE_N(k BETWEEN 1 
                            AND 10 
                            EACH    1));