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.
#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:
The query statement and query results are shown in the following figure:
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:
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!