MINIMUM Function Examples | Teradata Vantage - 17.10 - 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
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-28
dita:mapPath
SQL_Functions__Expressions__and_Predicates.Upload_071421/djk1612415574830.ditamap
dita:ditavalPath
SQL_Functions__Expressions__and_Predicates.Upload_071421/wrg1590696035526.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.