MariaDB Operators
Objectives
-
MariaDB Arithmetic Operators
-
MariaDB Comparison Operators
-
MariaDB Logical Operators
MariaDB Arithmetic Operators
Operator | Description | Example |
---|---|---|
+ | Add |
|
- |
Subtract |
|
* |
Multiply |
|
/ |
Divide |
|
% |
Modulo |
|
MariaDB Comparison Operators
Operator | Description | Example |
---|---|---|
= |
Equal to |
|
> |
Greater than |
|
< |
Less than |
|
>= |
Greater than or equal to |
|
<= |
Less than or equal to |
|
<> |
Not equal to |
|
MariaDB Logical Operators
AND
-
Description : TRUE if all the conditions separated by AND is TRUE
-
Example :
SELECT * FROM person WHERE age > 18 AND income < 300;
-
Details : Find the details of AND Operator
OR
-
Description : TRUE if any of the conditions separated by OR is TRUE
-
Example :
SELECT * FROM person WHERE age > 18 OR income < 300;
-
Details : Find the details of OR Operator
NOT
-
Description : Displays a record if the condition(s) is NOT TRUE
-
Example :
SELECT * FROM person WHERE NOT last_name = 'Doe';
-
Details : Find the details of NOT Operator
BETWEEN
-
Description : TRUE if the operand is within the range of comparisons
-
Example :
SELECT * FROM person WHERE income BETWEEN 100 AND 300;
-
Details : Find the details of BETWEEN Operator
IN
-
Description : TRUE if the operand is equal to one of a list of expressions
-
Example :
SELECT * FROM person WHERE income IN (100, 150, 200, 250);
-
Details : Find the details of IN Operator
LIKE
-
Description : TRUE if the operand matches a pattern
-
Example :
SELECT * FROM person WHERE first_name LIKE "%n%";
-
Details : Find the details of LIKE Operator