Skip to content

Operators

Mathematical operators

  • MINUS - - element-wise subtraction;
  • PLUS + - element-wise addition;
  • TIMES * - element-wise multiplication;
  • DIVIDE / - element-wise division.

Logical operators

  • AND & - can be used when we require multiple conditions to be met;
  • OR | - can be used when we require at least one condition of many to be met;

Comparison operators

  • GT > - greater than;
  • GTE >= - greater than or equal;
  • LT < - less than;
  • LTE <= - less than or equal;
  • EQ == - equal;
  • NEQ != - not equal;
  • CONTAINS in - an element or a pattern appears in; only works with string values.

Operator precedence

The order in which operators are evaluated in an expression is determined by operator precedence.

The rules are simple: - the highest precedence is given to expressions in parentheses;

A * (B + C)   # B + C gets evaluated first
- comparison operators have higher precedence than logical operators;
A > B & C < D equals to (A > B) & (C < D)
- multiplication and division have higher precedence than addition and subtraction:
A + B * C equals to A + (B * C)

  • Transform -> operator has the same precedence as multiplication and division
    SELECT(...) -> ROUND() * 100
    
    Therefore the above expression gets evaluated in the natural order.