The inequality symbol in SQL is <>, which is used to express inequality. Other inequality operators include != (equivalent to <>) and NOT IN (checks whether a value does not belong to a set of values).
Inequality symbol in SQL
In SQL, the symbol used to express inequality is <>
.
Usage Example
<code class="sql">SELECT * FROM table_name WHERE column_name <> 'value';</code>
In this example, the <>
notation will return all column_name
not equal to value
rows.
Other inequality operators
In addition to the <>
symbol, there are other inequality operators in SQL:
!=
: Equivalent to <>
NOT IN
: Checks whether the value does not belong to a Group ValueExample
<code class="sql">SELECT * FROM table_name WHERE column_name != 'value'; SELECT * FROM table_name WHERE column_name NOT IN ('value1', 'value2', 'value3');</code>
The above is the detailed content of How to write not equal in sql. For more information, please follow other related articles on the PHP Chinese website!