Examples: Using the MINIMUM Function - Teradata Vantage NewSQL Engine - 16.20

Teradata Vantage™ SQL Functions, Expressions, and Predicates

prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1145-162K

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.