O'Reilly logo

MySQL 8 Cookbook by Karthik Appigatla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Operators

MySQL supports many operators for filtering results. Refer to https://dev.mysql.com/doc/refman/8.0/en/comparison-operators.html for a list of all the operators. We will discuss a few operators here. LIKE and RLIKE are explained in detail in the next examples:

  • Equality: Refer to the preceding example where you have filtered using =.
  • IN: Check whether a value is within a set of values. For example, find the count of all employees whose last name is either ChristLamba, or Baba:
mysql> SELECT COUNT(*) FROM employees WHERE last_name IN ('Christ', 'Lamba', 'Baba');+----------+| COUNT(*) |+----------+|      626 |+----------+1 row in set (0.08 sec)
  • BETWEEN...AND: Check whether a value is within a range of values. For example, find the number ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required