The expressions and the result of arithmetic operations are each numeric values.
<expression-1> + <expression-2>
Adds the two expressions.
<expression-1> / <expression-2>
Divides the 1st expression by the 2nd expression.
<expression-1> % <expression-2>
Determines the remainder when dividing the 1st expression by the 2nd expression.
<expression-1> * <expression-2>
Forms the product of the two expressions.
<expression-1> - <expression-2>
Subtracts the 2nd expression from the 1st expression.
- <expression>
Returns the expression with reversed sign.
+ <expression>
Returns the expression unchanged.
The expressions and the result of character operations are each character strings.
<expression-1> || <expression-2>
Concatenates the two expressions into a character string.
The results of comparison operations are each boolean values.
The expressions to be compared must have the same data type.
<expression-1> = <expression-2>
<expression-1> == <expression-2>
SELECT NULL = NULL, NULL == NULL, 'a' == NULL, 'a' == 'b', 'a' == 'a';
Output
column_1 column_2 column_3 column_4 column_5
-------- -------- -------- -------- --------
null true null false true
<expression-1> != <expression-2>
or
<expression-1> <> <expression-2>
<expression-1> > <expression-2>
<expression-1> >= <expression-2>
<expression-1> < <expression-2>
<expression-1> <= <expression-2>
The expressions and the result of boolean operations are each of type Boolean.
<expression-1> AND <expression-2>
And for boolean expressions
<expression-1> OR <expression-2>
Or for boolean expressions
NOT <expression>
Negation of a boolean expression
<expression> IS [ NOT ] NULL
The expression can have any data type.
NOT is optional and negates the result
The result has the data type BOOLEAN.
SELECT NULL is NULL, 'a' IS NULL, 'b' is not null;
Output
column_1 column_2 column_3
-------- -------- --------
true false true
<expression-1> LIKE <expression-2>
Both expressions are character strings.
Result of the comparison:
SELECT 'huhu.xlsx' LIKE '%.xlsx', not 's12' like '_' ;
Output
column_1 column_2
-------- --------
true true
To negate the expression, use "not a like b" instead of "a not like b".
<expression-1> REGEXP_LIKE <expression-2>
Both expressions are character strings.
Result of the comparison:
SELECT 'huhu.xlsx' REGEXP_LIKE '.*\.xlsx', '18237636' REGEXP_LIKE '[0-9]*', not 's12' regexp_like '.' ;
Output
column_1 column_2 column_3
-------- -------- --------
true true true
CASE
WHEN <boolean-expression-1> THEN <expression-1>
...
WHEN <boolean-expression-n> THEN <expression-n>
[ ELSE <expression-else> ]
END
The expressions in THEN and ELSE must all have the same data type. The result also has this data type.
SELECT CASE WHEN 73*54 = 72 THEN 'Is 72' WHEN 73*54 = 3942 THEN 'Is 3942' ELSE 'No idea' END, CASE WHEN 1 IS NULL THEN 7 END;
Output
column_1 column_2
-------- --------
Is 3942 null