Home  >  Article  >  Database  >  What is the usage of in in mysql

What is the usage of in in mysql

醉折花枝作酒筹
醉折花枝作酒筹forward
2021-06-24 09:15:475692browse

In mysql, in is often used in where expressions, and its function is to query data within a certain range. Below, the editor will show you the usage of in in mysql. Friends in need can refer to it.

What is the usage of in in mysql

#in is often used in where expressions, and its function is to query data within a certain range.

Usage: select * from where field in (value1,value2,value3,…)

Example: Query all data with IDs 2 and 4 in the book table:

There is a book data table with the following content:

What is the usage of in in mysql

The query statement and query results are shown in the following figure:

What is the usage of in in mysql

PS: not in has the opposite effect of in. The usage and examples are as follows:

Usage: select * from where field not in (value1, value2, value3,…).

not in Example:

What is the usage of in in mysql

Related recommendations: "mysql tutorial"

The above is the detailed content of What is the usage of in in mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete