1.1 - 8.10 - Unpivoting Example: Specified Target Range, Default Optional Values - Teradata Vantage

Teradata Vantage™ - Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.1
8.10
Release Date
October 2019
Content Type
Programming Reference
Publication ID
B700-4003-079K
Language
English (United States)

This example specifies a range of target columns and uses the default values for the optional syntax elements.

SQL Call

This call is equivalent to the call in Unpivoting Example: Specified Target Columns, Default Optional Values.

SELECT * FROM Unpivoting (
  ON unpivot_input
  USING
  TargetColumns ('[3:5]')
  Accumulate ('sn','city','week')
  InputTypes ('false')
) AS dt ORDER BY 1,2,3;

Output

The output is the same as in Unpivoting Example: Specified Target Columns, Default Optional Values.

 sn city        week attribute value_col 
 -- ----------- ---- --------- --------- 
  1 asheville      1 temp      32       
  1 asheville      1 pressure  1020.8   
  1 asheville      1 dewpoint  27.6f    
  2 asheville      2 pressure  1021.3   
  2 asheville      2 dewpoint  27.4f    
  2 asheville      2 temp      32       
  3 asheville      3 dewpoint  28.2f    
  3 asheville      3 pressure  1021.7   
  3 asheville      3 temp      33       
  4 nashville      1 dewpoint  29.4f    
  4 nashville      1 pressure  1021.0   
  4 nashville      1 temp      42       
  5 nashville      2 temp      44       
  5 nashville      2 dewpoint  29.2f    
  5 nashville      2 pressure  1019.8   
  6 brownsville    2 dewpoint  28.9f    
  6 brownsville    2 pressure  1019.0   
  6 brownsville    2 temp      46       
  7 brownsville    3 dewpoint  28.9f    
  7 brownsville    3 pressure  1019.2   
  7 brownsville    3 temp      46

Download a zip file of all examples and a SQL script file that creates their input tables from the attachment in the left sidebar.