LEASTB

Returns the function's least argument, using binary ordering, not UTF-8 character ordering.

Behavior Type

Immutable

Syntax

LEASTB ( expression1, expression2, ... expression-n )

Parameters

expression1, expression2, and expression-n are the expressions to be evaluated.

Notes

Examples

The following command selects strasse as the least in the series of inputs:

=> SELECT LEASTB('straße', 'strasse');
 LEASTB
---------
 strasse
(1 row)

This example returns 5 as the least:

==> SELECT LEASTB(7, 5, 9);
 LEASTB
--------
      5
(1 row)

Putting quotes around the integer expressions returns the same result as the first example:

=> SELECT LEASTB('7', '5', '9');
 LEASTB
--------
 5
(1 row)

In the above example, the values are being compared as strings, so '10' would be less than '2'.

The next example returns 1.5, as INTEGER 2 is implicitly cast to FLOAT:

=> SELECT LEASTB(2, 1.5);
 LEASTB
--------
    1.5
(1 row)

The following example returns 'analytic' as the least in the series of inputs:

=> SELECT LEASTB('vertica', 'analytic', 'database');
  LEASTB
----------
 analytic
(1 row)

Notice this next command returns NULL:

=> SELECT LEASTB('vertica', 'analytic', 'database', null);
 LEASTB
--------

(1 row)

See Also