Arithmetic Operators

CQL supports the following operators:

Number Arithmetic

All arithmetic operations are supported on numeric types or counters. The return type of the operation will be based on the operand types: *, / and % operators have a higher precedence level than + and - operator. By consequence, they will be evaluated before. If two operator in an expression have the same precedence level, they will be evaluated left to right based on their position in the expression.

Datetime Arithmetic

duration can be added (+) or substracted (-) from a timestamp or a date to create a new timestamp or date. So for instance:

  1. SELECT * FROM myTable WHERE t = '2017-01-01' - 2d;

t which is in the last 2 days of 2016.