1.1 - 8.10 - Histogram Example: CustomBinTable - 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)

Input

bin_breaks
break
50.0
100.0
150.0
200.0
250.0
300.0
350.0

SQL Call

SELECT * FROM Histogram(
  ON cars_hist AS InputTable
  ON bin_breaks AS CustomBinTable
  OUT TABLE OutputTable(cars_hist_out2)
  USING
  CustomBinColumn('break')
  ValueColumn('hp')
  GroupbyColumns('cyl')
) AS dt;

Output

 output_table                      output_columns                                    
 --------------------------------- ------------------------------------------------- 
 specified in OutputTable argument "cyl" bin bin_start bin_end bin_count bin_percent
SELECT * FROM cars_hist_out2;
 cyl bin bin_start bin_end bin_count bin_percent 
 --- --- --------- ------- --------- ----------- 
   4   1     100.0   150.0         2       18.18
   4   3     200.0   250.0         0           0
   4   5     300.0   350.0         0           0
   8   1     100.0   150.0         0           0
   8   3     200.0   250.0         5       35.71
   8   5     300.0   350.0         1        7.14
   6   1     100.0   150.0         6       85.71
   6   3     200.0   250.0         0           0
   6   5     300.0   350.0         0           0
   4   0      50.0   100.0         9       81.82
   4   2     150.0   200.0         0           0
   4   4     250.0   300.0         0           0
   8   0      50.0   100.0         0           0
   8   2     150.0   200.0         7          50
   8   4     250.0   300.0         1        7.14
   6   0      50.0   100.0         0           0
   6   2     150.0   200.0         1       14.29
   6   4     250.0   300.0         0           0

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