LEAST Function Examples | Teradata Vantage - Examples - Analytics Database - Teradata Vantage

SQL Functions, Expressions, and Predicates

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-01-12
dita:mapPath
obm1628111499646.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
kby1472250656485
lifecycle
latest
Product Category
Teradata Vantageā„¢

Example: Querying for the Smallest Integer Value

The following query returns 6.

SELECT LEAST(13, 6);

Example: LEAST with DECIMAL Input

In the following query, if the input arguments have data types of DECIMAL(5,4) and DECIMAL(4,2), the return data type is DECIMAL(6,4) and the return value is 1.1234.

SELECT LEAST(1.1234, 36.12);

Example: LEAST with Character Input

The following query returns 'alpha'.

SELECT LEAST('apples', 'alpha');

Example: Comparing Time Zones in a TIMESTAMP

SELECT LEAST(CAST('2003-08-17 20:15:24-05:00' AS TIMESTAMP WITH TIME ZONE), CAST('2003-08-17 20:15:24-02:00' AS TIMESTAMP WITH TIME ZONE));

Result:

LEAST('2003-08-17 20:15:24-05:00','2003-08-17 20:15:24-02:00')
--------------------------------------------------------------
                              2003-08-17 20:15:24.000000-02:00