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
MySQL is divided into installation version and fr...
Check the transaction isolation level In MySQL, y...
Mixins provide distributed reusable functionality...
Do you add an alt attribute to the img image tag? ...
Tomcat itself optimization Tomcat Memory Optimiza...
This article shares the installation and configur...
This article uses an example to describe how MySQ...
Table of contents Preface Type Inference Truth va...
Table of contents About Maxwell Configuration and...
Table of contents Preface environment Install Cre...
This article shares the specific code of JavaScri...
This article example shares the specific code of ...
This article shares a simple HTML shopping quanti...
Here is a case of modal box dragging. The functio...
I learned a new trick today. I didn’t know it befo...