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: ...

Get MariaDB Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.