min
Aggregate Function
min — minimum value of input values
Synopsis
min(number|string) -> number|string
Description
The min aggregate function computes the minimum value of its input.
When determining the min of string inputs, values are compared via byte order. This is equivalent to C/POSIX collation as found in other SQL databases such as Postgres.
Examples
Minimum value of simple numeric sequence:
min(this)
1
2
3
4
Loading...
echo '1
2
3
4' \
| super -z -c 'min(this)' -
Continuous minimum of simple numeric sequence:
yield min(this)
1
2
3
4
Loading...
echo '1
2
3
4' \
| super -z -c 'yield min(this)' -
Minimum of several string values:
min(this)
"foo"
"bar"
"baz"
Loading...
echo '"foo"
"bar"
"baz"' \
| super -z -c 'min(this)' -
A mix of string and numeric input values results in an error:
min(this)
1
"foo"
2
Loading...
echo '1
"foo"
2' \
| super -z -c 'min(this)' -
Other unrecognized types in mixed input are ignored:
min(this)
1
2
3
4
127.0.0.1
Loading...
echo '1
2
3
4
127.0.0.1' \
| super -z -c 'min(this)' -
Minimum value within buckets grouped by key:
min(a) by k | sort
{a:1,k:1}
{a:2,k:1}
{a:3,k:2}
{a:4,k:2}
Loading...
echo '{a:1,k:1}
{a:2,k:1}
{a:3,k:2}
{a:4,k:2}' \
| super -z -c 'min(a) by k | sort' -