-
Notifications
You must be signed in to change notification settings - Fork 435
Operators
Rene Saarsoo edited this page Sep 4, 2022
·
42 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:
== -
Object key-value separator:
: - String concatenation:
||
- Arithmetic:
**3 -
Assignment:
:= - Attribute indicator:
% -
Comparison:
^=,~=3 -
FOR loop range:
.. -
Label delimiters:
<<,>> -
Named arguments:
=> - Remote access indicator:
@ - String concatenation:
||
-
Arithmetic:
%,^,|/(square root),||/(cube root),@(abs value) -
Assignment:
:= -
Bitwise:
&,|,#,~,>>,<< -
Geometric:
@-@,@@,#,##,<->,@>,<@,&&,<<,>>,&<,&>,<<|,|>>,&<|,|&>,<^,>^,?#,?-,?|,?-|,?||,~= -
JSON:
->,->>,#>,#>>,@>,?,?|,?&,||,#-,@?,@@ -
Named function params:
=> -
Network address:
<<,>>,<<=,>>=,&&,~,&,| -
Pattern matching:
~~,~~*,!~~,!~~* -
Posix Regex:
~,~*,!~,!~* -
Range/multirange:
@>,<@,&&,<<,>>,&<,&>,-|-, - String concatenation:
|| -
Text search:
@@,@@@,||,&&,!!,<->,@>,<@ -
Type cast:
::
- Arithmetic:
^,%,@(absolute value),|/(square root)||/cube root - Bitwise:
&,|,#,~,<<,>> - String concatenation:
||
-
Assignment:2
:= -
Bitwise:
&,|,^,~,>>,<< -
Comparison:
<=>(NULL-safe equal operator) - Logical:1
&&,||
Same as Hive. Additionally (perhaps also in Hive?):
- Arithmetic:
% - Bitwise:
~,&,|,<<,>> - Comparison:
== - JSON:
->,->> - String concatenation:
||
-
Arithmetic:
% -
Bitwise:
&,|,^,~ -
Comparison:
!<,!> -
Compound:
+=,-=,*=,/=,%=,&=,|=,^= -
Scope resolution:
::
- Arithmetic:
% -
Lambda expression:
-> -
Object key-value separator:
: - 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:
**,~=. Both of them produced an error.