Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use not in in mysql

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report