The <> operator is used in SQL to indicate that it is not equal to a certain condition. The example is as follows: SELECT * FROM table_name WHERE column_name <> 'value';
How to express not equal to a certain condition in SQL
In SQL, use the <>
operator to express not equal to a certain condition conditions. <>
Operator indicates that two expressions are not equal.
Example:
<code class="sql">SELECT * FROM table_name WHERE column_name <> 'value';</code>
This query will select all columns from the table_name
table that satisfy the column_name
column not equal to value
The row of the condition.
Other operators:
In addition to the <>
operator, there are other operators that can be used to compare values. These include:
: equal to
: not equal to
: less than
: greater than
: less than or equal to
: Greater than or equal to
Examples using these operators:
<code class="sql">SELECT * FROM table_name WHERE column_name = 'value'; SELECT * FROM table_name WHERE column_name != 'value'; SELECT * FROM table_name WHERE column_name < 10; SELECT * FROM table_name WHERE column_name > 10; SELECT * FROM table_name WHERE column_name <= 10; SELECT * FROM table_name WHERE column_name >= 10;</code>
The above is the detailed content of How to write not equal to a certain condition in sql. For more information, please follow other related articles on the PHP Chinese website!