In mysql, inequality can be expressed by "" or "!=", but generally "" is used to express inequality because " "Works in any SQL, is highly portable, and has fast query speeds.
The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.
The judgment symbol is commonly used in MySQL, and not equal is a more commonly used symbol. Let’s explain the following three not equal symbols
Symbol | Meaning |
---|---|
The earliest usage of not equal, the portability is better than the following two | |
Later added to MySQL, similar to not equal in programming languages such as Java | |
Add data after not in to indicate that it is not in the data |
It is recommended to use in MySQL to indicate not equal to . Why? Because has strong portability and because the query speed is fast. There is a question on leetcode, which is a query question for movie theaters. The question is as follows:
is actually very simple. If the query description is non-boring and the id is non-even, use the query results to order Just sort by by, but when querying description and non-boring, you need to use inequality to judge. The following is the comparison of query times using three types of inequality
You can see to express not equal
The above is the detailed content of How to express not equal in mysql. For more information, please follow other related articles on the PHP Chinese website!