Home > Database > Mysql Tutorial > body text

What is the not equal symbol in mysql

青灯夜游
Release: 2022-01-06 13:41:52
Original
13003 people have browsed it

There are two types of inequality symbols in mysql: "!=" and "<>"; they can both be used to determine whether numbers, strings, and expressions are not equal. For "!=" and "<>", if the operands on both sides are not equal, the return value is 1, otherwise the return value is 0; if one of the operands on both sides is NULL, the return value is also NULL.

What is the not equal symbol in mysql

The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.

In mysql, there are two types of inequality symbols:

  • ##<>

  • !=

Not equal to operator (

<> or !=) can be used for judgment Whether numbers, strings, and expressions are not equal. If the operands on both sides are not equal, the return value is 1, otherwise the return value is 0; if one of the operands on both sides is NULL, the return value is also NULL.

Example:Use <> and != to judge inequality

mysql> SELECT &#39;good&#39;<>&#39;god&#39;,1<>2,4!=4,5.5!=5,(1+3)!=(2+1),NULL<>NULL;
+---------------+------+------+--------+--------------+------------+
| &#39;good&#39;<>&#39;god&#39; | 1<>2 | 4!=4 | 5.5!=5 | (1+3)!=(2+1) | NULL<>NULL |
+---------------+------+------+--------+--------------+------------+
|             1 |    1 |    0 |      1 |            1 |       NULL |
+---------------+------+------+--------+--------------+------------+
1 row in set (0.00 sec)
Copy after login

As you can see from the results, the two inequality operators have the same effect. Comparison and judgment of numbers, strings, and expressions can be performed.

[Related recommendations:

mysql video tutorial]

The above is the detailed content of What is the not equal symbol in mysql. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template