Judgment symbols are often used in MySQL, and not equal to is a more commonly used symbol . The following three not equal to symbols are explained
MySQL recommends using <> to indicate inequality . Why? Because of its strong portability and fast query speed . There is a question on LeetCode, which is a movie theater query question. The title is as follows: In fact, it is very simple. You can query descriptions that are not boring and ids that are not even numbers, and sort the query results using order by. However, when querying descriptions that are not boring, you need to use the not equal to judgment. The following is a comparison of the query time I used three not equal to It can be seen that <> is still faster, so it is recommended to use <> to indicate inequality. There is no point in saying more, let’s give an example! ! !A simple table data: select * from user where address != "北京" select * from user where address <> "Beijing" select * from user where address = null select * from user where address is null select * from user where address != null Summarize: select * from user where address != "北京" select * from user where address <> "Beijing" select * from user where address = null select * from user where address is null select * from user where address != null select * from user where address is not null Just a few sentences and three extremely common points, perhaps we are at a loss and hesitant when answering. In <> and! = are equivalent. When a field is not equal to a certain value (a non-empty value), the output result is that this field is empty and not output. is and is not are used in conjunction with null . I call it is not, not empty. This concludes this article about the three uses and differences of MySQL not equal. For more relevant MySQL not equal content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Ten Experiences in Web Design in 2008
>>: Vue+openlayer5 method to get the coordinates of the current mouse slide
Without further ado Start recording docker pullin...
The database queries which object contains which ...
What I want to share today is to use native JS to...
We know that MySQL is a persistent storage, store...
Netease Kanyouxi official website (http://kanyoux...
Inline format <colgroup>...</colgroup>...
Table of contents 1. Introduction 2. Introduction...
There are two files a.htm and b.htm. In the same d...
The following operation demonstrations are all ba...
Query Rewrite Plugin As of MySQL 5.7.6, MySQL Ser...
I have been studying how to get https. Recently I...
The following analysis is about product design pr...
A status code that indicates a provisional respon...
You may remember that in the past articles we hav...
Here we mainly use spring-boot out of the box, wh...