SQL Operators for MariaDB Community Server 10.5

Overview

Structured Query Language (SQL) operators are keywords and symbols used to perform common arithmetic, logical, and matching operations on columns and column data.

Operator

Description

!

See NOT

!=

Not equal to

%

Modulo

&

Bitwise AND

&&

See AND

*

Multiply

+

Add

-

Subtract

/

Divide

:=

Assign value

<

Less than

<<

Bitwise left shift

<=

Less than or equal to

<=>

Equal to without special treatment for NULL

<>

See "!="

=

Equal to (if either value is NULL it returns NULL instead of 1 or 0)

>

Greater than

>=

Greater than or equal to

>>

Bitwise right shift

^

Bitwise exclusive OR

|

Bitwise OR

||

See OR

~

Bitwise not

ALL

Presence in all returned rows

AND

Logical And. Evaluates to 1 if both operands are non-zero, 0 if one or both operands are 0, NULL if either is NULL.

ANY

Presence in any returned rows

BETWEEN

Compares the return value of an expression to minimum and maximum arguments. Returns 1 if expression is greater than or equal to the minimum and less than or equal to the maximum, otherwise returns 0.

BINARY

Casts strings to binary values

DIV

Performs integer division

EXISTS

Presence of returned rows

IN

Presence of value in a list

IS

Boolean comparison

IS NOT

Boolean comparison, negative

LIKE

Performs pattern matching

MOD

Modulo

NOT

Logical not

NOT BETWEEN

Not present within a range

NOT IN

Not present in a list

NOT LIKE

Performs pattern matching, negative

NOT REGEXP

Non-match to a Regular Expression

NOT RLIKE

See NOT REGEXP

OR

Logical Or

REGEXP

Performs Regular Expression matching

RLIKE

See REGEXP

SOME

See ANY

SOUNDS LIKE

Performs Soundex matching

XOR

Logical Exclusive Or operator. Evaluates to 1 if an one operands is non-zero, zero if both are non-zero, NULL if either is NULL.