-
Notifications
You must be signed in to change notification settings - Fork 422
Operators
Rene Saarsoo edited this page Aug 16, 2022
·
41 revisions
All dialects support the following standard operators:
-
Arithmetic:
+
,-
,*
,/
-
Comparison:
=
,>
,>=
,<
,<=
,<>
,!=
-
Logical:
AND
,OR
,NOT
,IS
,IS NOT
The standard also defines operators that aren't supported a lot in actual implementations:
-
::
static method invocation -
->
attribute or method reference -
||
string concatenation -
..
embedded Ada and Pascal syntax
Below only additional non-standard operators are listed (the uncommon ones (::
, ->
, ||
, ..
) are assumed to be unsupported unless mentioned otherwise):
- Bitwise:
&
,|
,^
,~
,<<
,>>
- String/Array concatenation:
||
DB2:
-
Arithmetic:
**
-
Comparison:
¬=
,¬>
,!>
,¬<
,!<
- String concatenation:
CONCAT
,||
Hive:
- 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
,!
N1QL:
- Arithmetic:
%
- Comparison:
==
- String concatenation:
||
PL/SQL:3
-
Assignment:
:=
-
Comparison:
^=
-
FOR loop range:
..
-
Named arguments:
=>
- String concatenation:
||
TODO
- Arithmetic:
^
,%
,@
(absolute value),|/
(square root)||/
cube root - Bitwise:
&
,|
,#
,~
,<<
,>>
- String concatenation:
||
-
Assignment:2
:=
-
Bitwise:
&
,|
,^
,~
,>>
,<<
-
Comparison:
<=>
(NULL-safe equal operator) - Logical:1
&&
,||
- Arithmetic:
%
- Bitwise:
~
,&
,|
,<<
,>>
- Comparison:
==
- JSON:
->
,->>
- String concatenation:
||
Notes:
- Tested SingleStoreDB boolean operators manually. Found no docs for these.
- 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). - Tested on Oracle Live SQL playground the following operators:
>>
,<<
,**
,~=
. All of them produced an error.