TD_WhichMin Function Example | Teradata Vantage - TD_WhichMin 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_dataset

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 survived pclass sex    age sibsp parch  fare     cabin   embarked 
 --------- -------- ------ ------ --- ----- -----  -------  -----   -------- 
         1        0      3 male    22     1     0   7.25     null    S       
         2        1      1 female  38     1     0   71.28    C85     C       
         3        1      3 female  26     0     0   7.93     null    S       
         4        1      1 female  35     1     0   53.10    C123    S       
         5        0      3 male    35     0     0   8.05     null    S       

SQL Call

SELECT * FROM TD_WhichMin (
  ON titanic_dataset AS InputTable
  USING
  TargetColumn ('fare')
) AS dt;

Output

passenger survived pclass sex  age sibsp parch fare      cabin embarked 
 --------- -------- ------ ---- --- ----- ----- --------- ----- -------- 
         1        0      3 male  22     1     0 7.25       null  S