Mysql NOT EQUAL
From w3cyberlearnings
Contents |
MySQL NOT EQUAL Function
This function checks two inputs by using the NOT EQUAL comparison.
Syntax NOT EQUAL
a != b; OR a <> b;
Return
Returns 1 when the function is true, or otherwise returns 0.
Example 1
mysql> SELECT 3 != 2 eq1, 3 != 3 eq2, 3 <> 2 eq3; +-----+-----+-----+ | eq1 | eq2 | eq3 | +-----+-----+-----+ | 1 | 0 | 1 | +-----+-----+-----+ 1 row in set (0.00 sec)
Example 2
mysql> SELECT * FROM myscore -> WHERE score != 30; +----+-------+--------------+ | id | score | student_name | +----+-------+--------------+ | 2 | 40 | Jing | | 3 | 34 | Kim | +----+-------+--------------+ 2 rows in set (0.00 sec) mysql> SELECT * FROM myscore -> WHERE score <> 30; +----+-------+--------------+ | id | score | student_name | +----+-------+--------------+ | 2 | 40 | Jing | | 3 | 34 | Kim | +----+-------+--------------+ 2 rows in set (0.00 sec)