Operator Overview

Arithmetic operator

Name

Description

%,MOD

Take the rest

*

Multiplication

+

Addition

-

Subtraction

-

minus sign

/

Division

DIV

For integer division

Assignment operator

Name

Description

=

equal operator, used for assignment

Binary Operator

Name

Description

&

bit operator and, bitwise and

>>

Shift the displacement operator right

<<

Distance operator shift left

^

Bitwise XOR

|

bit operator or, bitwise or

~

Unary operator, binary inversion

Cast function and operator

Name

Description

BINARY()

Functions that convert values ​​to binary strings

CAST()

Convert values ​​to specific types for decimal values ​​and character types

CONVERT()

Convert values ​​to specific types for conversion between date and time values ​​and decimals

Comparison functions and operators

Name

Description

>

greater than

>=

greater than or equal to

<

Less than

<>,!=

Not equal

<=

Less than or equal to

=

equals

BETWEEN … AND …

Between two values ​​

IN()

In the collection

IS

Test whether the value is a Boolean value. If it is a Boolean value, it returns “true”

IS NOT

Test whether the value is a boolean value, negative usage of IS

IS NOT NULL

Not empty

IS NULL

empty

ISNULL

Use instead of = to test whether the value is NULL.

LIKE

Fuzzy matching

ILIKE

Fuzzy matching, same as LIKE. But it is not case sensitive.

NOT BETWEEN … AND …

Not between two values ​​

NOT IN

Abbreviation of multiple XOR conditions

NOT LIKE

Fuzzy matching, negative usage of Like

COALESCE

Returns the first non-null value

Control Flow Function

Name

Description

CASE

Case when operator

IF()

If/else statement

IFNULL()

If null/else statement

NULLIF()

NULL is returned when expr1 = expr2, otherwise it returns expr1

Logical operator

Name

Description

AND,&&

Logic and

NOT,!

Logical non

OR

Logical or

XOR

Logical XOR