Learning MySQL By Example
1.6

Comparison Operators

Comparison Operators

  • Comparison operators compare two expressions.
  • The result of a comparison results to true or false.
  • Comparison operators are not case sensitive and are used with text and dates as well as numbers.

Table 5. Comparison Operators

Operator

Description

=

Equal

Less than

Greater than

<=

Less than or equal to

>=

Greater than or equal to

<> 

Not equal

!=

Not equal

Example:

USE world;
SELECT name, population
FROM country
WHERE population > 1000000;

Results:

comparison_operators.png

CC BY-NC-ND International 4.0

CC BY-NC-ND International 4.0: This work is released under a CC BY-NC-ND International 4.0 license, which means that you are free to do with it as you please as long as you (1) properly attribute it, (2) do not use it for commercial gain, and (3) do not create derivative works.

End-of-Chapter Survey

: How would you rate the overall quality of this chapter?
  1. Very Low Quality
  2. Low Quality
  3. Moderate Quality
  4. High Quality
  5. Very High Quality
Comments will be automatically submitted when you navigate away from the page.
Like this? Endorse it!