Home > Database > Mysql Tutorial > What is the usage of in in mysql

What is the usage of in in mysql

醉折花枝作酒筹
Release: 2021-06-24 09:15:47
forward
5830 people have browsed it

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!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template