mysql is not equal to notation

  • 2020-05-30 21:11:54
  • OfStack

It was found to be used in mysql after testing < > With the! = both are ok, but not recognized in sqlserver != Therefore, it is recommended to use <>

selece * from jb51 where id < > 45

sql symbols in < > In! = the difference between

< > With the! = is not equal to, but 1 is usually used < > The incoming code does not equal because < > It works in any SQL but! = used in sql2000, it is syntactically incorrect and incompatible

sql equals and not equals,' =','! = ', ' < > ','is null'....
Is not equal to: < > ,! =,~=,^= these four symbols are said to be able to indicate not equal in oracle, but they were found after trying < > ,! =,^= is ok, ~= is not ok < > Is the standard sql grammar, portable, the other are features of oracle platform, poor portability, so the development, as far as possible to use < > Means not equal to

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 look up the record that amount is equal to null,

select * from bl_ip_dt where amount < > A simple query for 800 or amount is null is not equal to NULL

aa in the query table is the data of null:

select * from table where aa is null;

The data in the query table that aa does not equal 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 considered a distinct value. To test NULL, you cannot use the arithmetic comparison operator such as =, < Or!!! =. To illustrate it, try the following query:

mysql > 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 implicit carefulness value of a Boolean operation is 1.

is null or IFNULL(SUM(),XXX) are often used in development.

Also in php < > And! Both are available

$a == $b is equal to TRUE, if $a is equal to $b.
$a === $b congruent TRUE, if $a is equal to $b and they are of the same type. (introduced by PHP 4)
$a! = $b not equal to TRUE, if $a does not equal $b.
$a < > $b does not equal TRUE, if $a does not equal $b.
$a! == $b partial TRUE, if $a does not equal $b, or if they are of a different type. (introduction of PHP 4)
$a < $b is smaller than TRUE if $a is strictly less than $b.
$a > $b is greater than TRUE, if $a is strictly $b.
$a < = $b is less than or equal to TRUE, if $a is less than or equal to $b.
$a > = $b is greater than or equal to TRUE, if $a is greater than or equal to $b.


Related articles: