Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to represent non-equal symbols in mysql

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Today, I would like to talk to you about how mysql is not equal to symbols, many people may not know much about it. In order to make you understand better, the editor summarized the following content for you. I hope you can get something according to this article.

After testing, it is found that it is possible to use and! = in mysql, but it is not recognized in sqlserver, so it is recommended to use

Selece * from jb51 where id45

The difference between the symbol "! =" in sql

It is not equal to! =, but it is generally used to code because it works in any SQL, but! = is used in sql2000, it is grammatical error and incompatible

The sum in sql is not equal to,'=','! =',','is null'.....

Not equal to:! =, ~ =, ^ = these four symbols are said to be able to express non-equals in oracle, but after trying, it is found that! =, ^ = is OK, ~ = no, it should be noted that only the standard sql syntax is portable, the rest are oracle platform features, portability is poor, so in development, try to use expression is not equal to

Equal to: = needless to say, but to determine the equality of null, you must use is null or is not null,null can only be judged by is null or is not null, other operators and null operations are false.

For example, select * from bl_ip_dt where amount 800. this statement does not find the record where amount equals null

Select * from bl_ip_dt where amount 800or amount is null is OK.

MySql's simple query is not equal to NULL

Query the data in the table where aa is null:

Select * from table where aa is null

Query data in the table where aa is not equal to 1:

Select * from table where aa 1

NULL value operation:

The NULL value can be strange until you get used to it. Conceptually, NULL means "no value" or "unknown value", and it is regarded as a different value. To test NULL, you cannot use arithmetic comparison operators such as =, SELECT 1 = NULL, 1 NULL, 1

< NULL, 1 >

NULL

+-+

| | 1 = NULL | 1 NULL | 1 |

< NULL | 1 >

NULL |

+-+

| | NULL | NULL | NULL | NULL | |

+-+

Obviously you can't get meaningful results from these comparisons. Instead, use the IS NULL and IS NOT NULL operators:

Mysql > SELECT 1 IS NULL, 1 IS NOT NULL

+-+ +

| | 1 IS NULL | 1 IS NOT NULL |

+-+ +

| | 0 | 1 |

+-+ +

Note that in MySQL, 0 or NULL means false and other values mean true. The default true value for Boolean operations is 1.

Self-perception is null or IFNULL (SUM (), XXX) is often used in development.

In addition, both! and! = can be used in php.

$a = = $b equals TRUE if $an equals $b.

$a = = $b congruent TRUE, if $an equals $b, and they are of the same type. (introduced by PHP 4)

$a! = $b is not equal to TRUE if $an is not equal to $b.

$a $b is not equal to TRUE if $an is not equal to $b.

$a! = $b non-congruent TRUE, if $an is not equal to $b, or they are of different types. (introduced by PHP 4)

$a

< $b 小与 TRUE,如果 $a 严格小于 $b。   $a >

$b is greater than TRUE if $an is strict $b.

$a = $b greater than or equal to TRUE, if $an is greater than or equal to $b.

After reading the above, do you have any further understanding of how to express symbols that are not equal to symbols in mysql? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report