For the complete documentation index, see llms.txt. This page is also available as Markdown.

NOT IN

Test whether a value matches none of the values in a list. expr NOT IN (value,...) is the same as NOT (expr IN (value,...)).

Syntax

expr NOT IN (value,...)
expr NOT IN (subquery)

Description

This is the same as NOT (expr IN (value,...)).

With a subquery, expr NOT IN (subquery) is the same as expr <> ALL (subquery). See Subqueries with IN and NOT IN.

Examples

SELECT 2 NOT IN (0,3,5,7);
+--------------------+
| 2 NOT IN (0,3,5,7) |
+--------------------+
|                  1 |
+--------------------+
SELECT 'wefwf' NOT IN ('wee','wefwf','weg');
+--------------------------------------+
| 'wefwf' NOT IN ('wee','wefwf','weg') |
+--------------------------------------+
|                                    0 |
+--------------------------------------+

NULL:

See Also

This page is licensed: GPLv2, originally from fill_help_tables.sql

spinner

Last updated

Was this helpful?