Home > Database > SQL > body text

How to write not equal in sql

下次还敢
Release: 2024-05-01 23:36:13
Original
940 people have browsed it

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).

How to write not equal in sql

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>
Copy after login

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 Value

Example

<code class="sql">SELECT * FROM table_name
WHERE column_name != 'value';

SELECT * FROM table_name
WHERE column_name NOT IN ('value1', 'value2', 'value3');</code>
Copy after login

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template