rand() returns a random floating point number in the range from 0 (inclusive) to 1 (exclusive); i.e.[0,1). The numbers returned follow an approximate uniform distribution.
Syntax: rand()
Returns:
A Float.
Query:
SELECT *
FROM cypher('graph_name', $$
RETURN rand()
$$) as (r agtype);
A random number is returned.
Result:
abs() returns the absolute value of the given number.
Syntax: abs(expression)
Returns:
The type of the value returned will be that of expression.
Arguments:
Considerations:
Query:
SELECT *
FROM cypher('graph_name', $$
MATCH (a), (e) WHERE a.name = 'Alice' AND e.name = 'Eskil'
RETURN a.age, e.age, abs(a.age - e.age)
$$) as (alice_age agtype, eskil_age agtype, difference agtype);
The absolute value of the age difference is returned.
Result:
ceil() returns the smallest floating point number that is greater than or equal to the given number and equal to a mathematical integer.
Syntax: ceil(expression)
Returns:
A Float.
Arguments:
Considerations:
Query:
SELECT *
FROM cypher('graph_name', $$
RETURN ceil(0.1)
$$) as (cil agtype);
The ceiling of 0.1 is returned.
Result:
floor() returns the greatest floating point number that is less than or equal to the given number and equal to a mathematical integer.
Syntax: floor(expression)
Returns:
A Float.
Arguments:
Considerations:
Query:
SELECT *
FROM cypher('graph_name', $$
RETURN floor(0.1)
$$) as (flr agtype);
The floor of 0.1 is returned.
Result:
round() returns the value of the given number rounded to the nearest integer.
Syntax: round(expression)
Returns:
A Float.
Arguments:
`
Considerations:
Query:
SELECT *
FROM cypher('graph_name', $$
RETURN round(3.141592)
$$) as (rounded_value agtype);
3.0 is returned.
Result:
sign() returns the signum of the given number: 0 if the number is 0, -1 for any negative number, and 1 for any positive number
Syntax:sign(expression)
Returns:
An Integer.
Arguments:
Considerations:
Query:
SELECT *
FROM cypher('graph_name', $$
RETURN sign(-17), sign(0.1), sign(0)
$$) as (negative_sign agtype, positive_sign agtype, zero_sign agtype);
The signs of -17 and 0.1 are returned.
Result: