MAXIMUM Function Examples | Teradata Vantage - 17.00 - 17.05 - Examples: Using the MAXIMUM Function - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - SQL Functions, Expressions, and Predicates

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
17.05
Published
June 2020
Language
English (United States)
Last Update
2021-01-30
dita:mapPath
tpt1555966086716.ditamap
dita:ditavalPath
lze1555437562152.ditaval

Example: CHARACTER Data

The following SELECT returns the immediately following result.

   SELECT MAX(Name) 
   FROM Employee; 
   
   Maximum(Name)
   -------------
   Zorn J

Example: Column Expressions

You want to know which item in your warehouse stock has the maximum cost of sales.

   SELECT MAX(CostOfSales) AS m, ProdID 
   FROM Inventory
   GROUP BY ProdID
   ORDER BY m DESC;
   
   Maximum(CostOfSales)  ProdID
   --------------------  ------
                   1295    3815
                    975    4400
                    950    4120

For time series examples, see Teradata Vantageā„¢ - Time Series Tables and Operations, B035-1208.