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

Teradata Vantage™ - SQL Functions, Expressions, and Predicates

Product
Advanced SQL Engine
Teradata Database
Release Number
16.20
Published
March 2019
Language
English (United States)
Last Update
2020-03-25
dita:mapPath
xzf1512079057909.ditamap
dita:ditavalPath
TD_DBS_16_20_Update1.ditaval
dita:id
kby1472250656485

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.