您的当前位置:首页正文

MySQL中in是什么意思

来源:华佗小知识

MySQL中in是什么意思

in常用于where表达式中,其作用是查询某个范围内的数据。

推荐:

基本语法:

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

使用示例:查询book表中id为2和4的所有数据:

有book数据表,内容如下:

查询语句和查询结果见如下图示:

补充:

not in与in作用相反,用法和示例如下:

用法:

select * from table where field not in (value1,value2,value3,…)

not in 示例:

更多技术请关注。