Home >Database >Mysql Tutorial >How to write not equal in mysql
MySQL There are two ways to write inequalities: the inequality sign () and the inequality keyword (NOT EQUAL TO). The two writing methods have the same function. You can use to compare whether two values are not equal, such as: SELECT FROM table_name WHERE column_name value; you can also use NOT EQUAL TO, such as: SELECT FROM table_name WHERE column_name NOT EQUAL TO value.
How to write the inequality operator in MySQL
There are two ways to write the inequality operator in MySQL:
For example:
SELECT * FROM table_name WHERE column_name < ;> value;
For example:
SELECT * FROM table_name WHERE column_name NOT EQUAL TO value;
These two writing methods have the same function and can be used to compare whether two values are not equal.
Example
The following query finds all records in the table_name
table where column_name
is not equal to value
:
SELECT * FROM table_name WHERE column_name <> value;
The following query finds all records in the table_name
table where column_name
is not equal to value
:
SELECT * FROM table_name WHERE column_name NOT EQUAL TO value;
Note:
Unlike other relational database management systems (such as Oracle), MySQL does not support the !=
operator.
The above is the detailed content of How to write not equal in mysql. For more information, please follow other related articles on the PHP Chinese website!