Get the App
SLTechnology News&Howtos  ›  Database  › 

How to use not in in mysql

Shulou Source: shulou.com Published: 2022-05-31 12:19:46 10月25日 Update

Editor to share with you how to use not in in mysql. I hope you will get something after reading this article. Let's discuss it together.

In mysql, "not in" is used to determine whether the value of the expression does not exist in the given list, and the syntax is "expr NOT IN (value1,value2,...)"; if the value of the expression does not exist in the specified list, the return result is 1, otherwise the return result is 0.

The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.

NOT IN is used to determine whether the value of the expression does not exist in the given list; if not, the return value is 1, otherwise the return value is 0.

The syntax format is as follows:

Expr NOT IN (value1, value2, value3... ValueN)

Expr represents the expression to be judged, value1, value2, value3. ValueN represents the value in the list. MySQL compares the values of expr to the values in the list one by one.

Examples are as follows:

Mysql > SELECT 2 NOT IN (1pyrmus 3pyrm 5jinthks`), 'thks' NOT IN (1recorder 3pence5jingthks`) +-+-+ | 2 NOT IN (1meme 3jorie 5jinthks') | 'thks' NOT IN (1meme 3meme 5) 'thks') | +-+-+ | 1 | 0 | +-+- -- + 1 row in set 2 warnings (0.00 sec)

When there is a null NULL on either side of the NOT IN operator, the return value is NULL; if no match is found. If a match is found, the return value is 0.

Examples are as follows:

Mysql > SELECT NULL NOT IN (1 NOT IN, 3, 5, 5), 10, 10, 10, 10, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 10, 10, 10, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 10, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 10, 5, 5, 5, 5, 5, 1, 5, 5, 5, 1, 5, 5, 5, 5, 5, 10, 10, 10, 10, 5, 5, 5, 1, 5, 5, 5, 1, 5, 5, 5, 1, 5, 5, 5, 1, 5, 5, 5, 1, 5, 5, 5, 5, 10, 10, 10, +-+-+ | NULL NOT IN (1meme 3je 5jinthks') | 10 NOT IN (1memo zero null) 'thks') | +-+-+ | NULL | NULL | +-+- -- + 1 row in set 1 warning (0. 00 sec) mysql > SELECT NULL NOT IN (1 mine3, 5 records`), 10 NOT IN (1 pedigre10) +-+-+ | NULL NOT IN (1meme 3je 5jinthks') | 10 NOT IN (1mem10 null) 'thks') | +-+-+ | NULL | 0 | +-- -+-- + 1 row in set (0.00 sec) finished reading this article I believe you have a certain understanding of "how to use not in in mysql". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Tags: Expressions examples articles results grammar done tutorials more formats versions environment computers knowledge systems industry information information channels operators channels operations Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi macOS MariaDB Microsoft Shulou Technology