|
Compare two values for equality. | |
|
Compare two values for inequality. | |
|
Compare two (potentially empty) values for equality. | |
|
Compare two (potentially empty) values for inequality. | |
|
Less than operator. | |
|
Greater than operator. | |
|
Less or equal operator. | |
|
Greater or equal operator. | |
|
A polymorphic function to calculate a "length" of its first argument. | |
|
A polymorphic function to test if a sequence contains a certain element. | |
|
A polymorphic function to find index of an element in a sequence. | |
|
Round to the nearest value. | |
|
Return a pseudo-random number in the range 0.0 <= x < 1.0. |
Compare two values for equality.
db>
SELECT 3 = 3.0;{true}db>
SELECT [1, 2] = [1, 2];{true}db>
SELECT (x := 1, y := 2) = (x := 1, y := 2);{true}db>
SELECT 'hello' = 'hello';{true}Compare two values for inequality.
db>
SELECT 3 != 3.14;{true}Compare two (potentially empty) values for equality.
Works the same as regular =, but also allows
comparing {}. Two {} are considered equal.
db>
SELECT {1} ?= {1.0};{true}db>
SELECT {1} ?= <int64>{};{false}db>
SELECT <int64>{} ?= <int64>{};{true}Compare two (potentially empty) values for inequality.
Works the same as regular !=, but also allows
comparing {}. Two {} are considered equal.
db>
SELECT {2} ?!= {2};{false}db>
SELECT {1} ?!= <int64>{};{true}db>
SELECT <bool>{} ?!= <bool>{};{false}Less than operator.
Return true if the value of the left expression is less
than the value of the right expression.
db>
SELECT 1 < 2;{true}db>
SELECT 2 < 2;{false}Greater than operator.
Return true if the value of the left expression is greater
than the value of the right expression.
db>
SELECT 1 > 2;{false}db>
SELECT 3 > 2;{true}Less or equal operator.
Return true if the value of the left expression is less
than or equal to the value of the right expression.
db>
SELECT 1 <= 2;{true}db>
SELECT 'aaa' <= 'bbb';{true}Greater or equal operator.
Return true if the value of the left expression is greater
than or equal to the value of the right expression.
db>
SELECT 1 >= 2;{false}A polymorphic function to test if a sequence contains a certain element.
When the haystack is str or bytes,
return true if needle is contained as a subsequence in it
and false otherwise.
When the haystack is an array, return true if
the array contains the specified element and false otherwise.
db>
SELECT contains('qwerty', 'we');{true}
db>
SELECT contains(b'qwerty', b'42');{false}
db>
SELECT contains([2, 5, 7, 2, 100], 2);{true}A polymorphic function to find index of an element in a sequence.
When the haystack is str or bytes,
return the index of the first occurrence of needle in it.
When the haystack is an array, return the index of
the first occurrence of the specific needle element. For
array inputs it is also possible to provide an
optional from_pos argument to specify the position from
which to start the search.
If the needle is not found, return -1.
db>
SELECT find('qwerty', 'we');{1}
db>
SELECT find(b'qwerty', b'42');{-1}
db>
SELECT find([2, 5, 7, 2, 100], 2);{0}
db>
SELECT find([2, 5, 7, 2, 100], 2, 1);{3}Round to the nearest value.
There’s a difference in how ties (which way 0.5 is rounded)
are handled depending on the type of the input value.
float64 tie is rounded to the nearest even number:
db>
SELECT round(1.2);{1}
db>
SELECT round(1.5);{2}
db>
SELECT round(2.5);{2}decimal tie is rounded away from 0:
db>
SELECT round(1.2n);{1n}
db>
SELECT round(1.5n);{2n}
db>
SELECT round(2.5n);{3n}Additionally, when rounding a decimal
value an
optional argument d can be provided to specify to what decimal
point the value must to be rounded.
db>
SELECT round(163.278n, 2);{163.28n}
db>
SELECT round(163.278n, 1);{163.3n}
db>
SELECT round(163.278n, 0);{163n}
db>
SELECT round(163.278n, -1);{160n}
db>
SELECT round(163.278n, -2);{200n}Return a pseudo-random number in the range 0.0 <= x < 1.0.
db>
SELECT random();{0.62649393780157}