Home  >  Article  >  Database  >  How to express not equal to null in sql

How to express not equal to null in sql

下次还敢
下次还敢Original
2024-04-28 10:45:21375browse

The expression that is not equal to NULL in SQL is: IS NOT NULL. This operator checks whether an expression is not equal to NULL and returns a Boolean value: TRUE if the expression is not equal to NULL; otherwise, FALSE.

How to express not equal to null in sql

The representation of not equal to NULL in SQL

In SQL, not equal to NULL can be represented by the following operators :

IS NOT NULL

Detailed description:

  • IS NOT NULL Operation operator is used to check whether an expression is not equal to NULL.
  • It returns a Boolean value: TRUE if the expression is not equal to NULL; otherwise, FALSE.
  • This operator can be applied to any expression that can return a NULL value, such as a column, function, or subquery.

Example:

<code class="sql">SELECT * FROM table_name WHERE column_name IS NOT NULL;</code>

This query will return all the column_name columns in the table_name table that are not equal to NULL OK.

Note:

  • IS NOT NULL is different from NOT NULL. NOT NULL is a constraint used to force a column not to store NULL values ​​when the table is created, while IS NOT NULL is an operator used to check whether an expression is not equal to NULL.
  • The IS NOT NULL operator also returns NULL if the expression itself is NULL.

The above is the detailed content of How to express not equal to null in sql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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