MINIMUM Function Examples | Teradata Vantage - Examples: Using the MINIMUM Function - Advanced SQL Engine - Teradata Database

SQL Functions, Expressions, and Predicates

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

Example: MINIMUM Used with CHARACTER Data

The following SELECT returns the immediately following result.

   SELECT MINIMUM(Name) 
   FROM Employee; 
   
   Minimum(Name)
   -------------
   Aarons A    

Example: JIT Inventory

Your manufacturing shop has recently changed vendors and you know that you have no quantity of parts from that vendor that exceeds 20 items for the ProdID. You need to know how many of your other inventory items are low enough that you need to schedule a new shipment, where “low enough” is defined as fewer than 30 items in the QUANTITY column for the part.

   SELECT ProdID, MINIMUM(QUANTITY)
   FROM Inventory
   WHERE QUANTITY BETWEEN 20 AND 30
   GROUP BY ProdID
   ORDER BY ProdID;

The report is as follows:

        ProdID  Minimum(Quantity)
   -----------  -----------------
          1124                 24
          1355                 21
          3215                 25
          4391                 22

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