In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail how to use the "" operator in MySQL. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Question:
When I looked at the code of a former developer, I saw
? 1WHERE p.name NULL
What does the symbol mean in this query? Is it the same as the = sign? Is it still a grammatical error? But no errors or exceptions are displayed. I already know the =! = and other symbols in mysql.
Best answer:
The similarities with the = sign
Like the regular = operator, the two values are compared and the result is 0 (not equal) or 1 (equal); in other words: 0 for'A 'and 1 for' a'.
two。 The difference between the sign and the = sign
Unlike the = operator, the value of NULL is meaningless. So the = operator cannot take NULL as a valid result. So: please use the
'a 'NULL gets 0 NULL NULL and gets 1. In contrast to the = operator, the rule of the = operator is' a'=NULL, the result is NULL and even the NULL = NULL result is NULL. By the way, almost all operators and functions on mysql work this way, because comparisons with NULL are basically meaningless.
Use
When two operands may contain NULL, you need a consistent statement.
? 1...WHERE col_a?...
The placeholder here may be constant or NULL, and you don't need to make any changes to the query when using the operator.
Correlation operator
In addition, there are two other operators that handle a value for comparison with NULL, that is, IS NULL and IS NOT NULL. They are part of the ANSI standard, so they can also be used in other databases. It can only be used in mysql.
You can use it as a dialect in mysql.
? 12 NOT'IS NULL = >'a 'NULL'a' IS NOT NULL = = > NOT (' a 'NULL)
Accordingly, you can make this query field a little more portable:
? 1WHERE p.name IS NULL
This is the end of the article on "how to use MySQL" and "operator". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.