Skip to content
Daniël van Eeden edited this page Mar 13, 2024 · 36 revisions

All dialects support the following standard operators:

The standard also defines operators that aren't supported a lot in actual implementations:

Below only additional non-standard operators are listed (the uncommon ones (::, ->, ||, ..) are assumed to be unsupported unless mentioned otherwise):

  • Bitwise: &, |, ^, ~, <<, >>
  • Comparison: IS [NOT] DISTINCT FROM
  • String/Array concatenation: ||

DB2:

  • Arithmetic: %, DIV
  • Bitwise: ~, ^, |, &
  • Comparison: ==, <=> (NULL-safe equal operator)
  • Logical: !
  • String concatenation: ||
  • Arithmetic: %, MOD, DIV
  • Assignment: :=
  • Bitwise: &, |, ^, ~, >>, <<
  • Comparison: <=> (NULL-safe equal operator)
  • Logical: &&, ||, XOR, !
  • Arithmetic: %, MOD, DIV
  • Assignment: :=
  • Bitwise: &, |, ^, ~, >>, <<
  • Comparison: <=> (NULL-safe equal operator)
  • JSON: ->, ->>
  • Logical: &&, ||, XOR, !
  • Arithmetic: ^, %, @ (absolute value), |/ (square root) ||/ cube root
  • Bitwise: &, |, #, ~, <<, >>
  • String concatenation: ||
  • Type cast: ::

SingleStoreDB:

Same as Hive. Additionally (perhaps also in Hive?):

  • Arithmetic: %
  • Bitwise: ~, &, |, <<, >>
  • Comparison: ==
  • JSON: ->, ->>
  • String concatenation: ||

TiDB:

Transact-SQL:

Notes:

  1. Tested SingleStoreDB boolean operators manually. Found no docs for these.
  2. SingleStoreDB only clearly documents the use of = operator for assignment, but testing shows that := works as well (the docs also contain a lonely example that uses the := syntax).
  3. Tested on Oracle Live SQL playground the following operators: **, ~=. Both of them produced an error.
  4. Treated as exponentiation when SQL_COMPAT='NPS', normally treated as XOR.