TD_RoundColumns Example | Teradata Vantage - TD_RoundColumns Example - Teradata® Database

Database Analytic Functions

Product
Teradata® Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-28
dita:mapPath
Teradata_Vantage™___Advanced_SQL_Engine_Analytic_Functions.withLogo_upload_July2021/wnd1589838592459.ditamap
dita:ditavalPath
Teradata_Vantage™___Advanced_SQL_Engine_Analytic_Functions.withLogo_upload_July2021/ayr1485454803741.ditaval
dita:id
B035-1206
lifecycle
previous
Product Category
Teradata Vantage™

InputTable: titanic

Every complete example in this document is available in a zip file that you can download. The zip file includes a SQL script file that creates the input tables for the examples. If you are reading this document on https://docs.teradata.com/, you can download the zip file from the attachment in the left sidebar.

passenger pclass  fare      survived 
 --------- ------  --------- -------- 
         1      3  7.25       0
         2      1  71.2833    1
         3      3  7.925      1
         4      1  53.100     1
         5      3  8.050      0

SQL Call

SELECT * FROM TD_RoundColumns (
  ON titanic AS InputTable
  USING
  TargetColumns ('Fare')
  PrecisionDigit (1)
  Accumulate ('[0:1]','Survived')
) AS dt;

Output

passenger pclass survived   fare      
 --------- ------ --------  --------- 
         1      3        0   7.30
         2      1        1   71.30
         3      3        1   7.90
         4      1        1   53.10
         5      3        0   8.10