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
This article mainly introduces how to implement a...
First, let’s understand what Docker is? Docker is...
1. Rendering 2. Source code HTML < body > &...
After Ubuntu 20.04 is installed, there is no root...
Result:Implementation Code html <div class=...
MySQL database tables can create, view, rebuild a...
This article mainly introduces three methods of i...
(Win7 system) VMware virtual machine installation...
The development of Docker technology provides a m...
background The popularity of Docker is closely re...
HTML web page list tag learning tutorial. In HTML ...
Table of contents Block-level functions Directly ...
Today I found that a program inserted an incorrec...
This article example shares the specific code of ...
1. Use of CSS scope (style division) In Vue, make...