Working with operators
In our examples, we used several operators, such as equals (=
), less than, and greater than (<
, >
), and others. Now it is time to discuss operators in general, and list the most important ones.
In general, an operator is a sign that takes one or more operands, and returns a result. Several groups of operators exist in MariaDB. In this section, we will discuss the main types:
Comparison operators
String operators
Logical operators
Arithmetic operators
Comparison operators
A comparison operator checks if there is a certain relationship between its operands. If the relationship exists, the operator returns 1
; otherwise it returns 0
. For example, let's take the equality
operator, which is probably the most used:
1 = 1 -- returns 1: the equality relationship exists 1 = 0 -- returns 0: no equality relationship here
In MariaDB, 1
and 0
are used in many contexts to indicate if something is true
or false
. In fact, MariaDB does not have a Boolean data type, so TRUE
and FALSE
...