mysql in 和 not in 语句用法

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql in 和 not in 语句用法相关的知识,希望对你有一定的参考价值。

1.mysql in语句

select * from tb_name where id in (10,12,15,16);
2.mysql not in 语句

select * from tb_name where not id in (21,22,23);
3.mysql in not in 一起使用

select * from tb_name where id in (10,12,15,16) and not id in (21,22,23);



以上是关于mysql in 和 not in 语句用法的主要内容,如果未能解决你的问题,请参考以下文章

mysql 中 in的用法

MySQL的WHERE语句中BETWEEN与IN的用法和他们的区别

MySQL的WHERE语句中BETWEEN与IN的用法和他们的区别

oracle_not exists和not in的用法和区别

数据库in的用法

NOT EXIST和NOT IN 和MINUS的用法