in的用法

select * from emp where sal in (1500,3000,5000)
等价于
select * from emp where sal =1500 or sal=3000 or sal=5000

select * from emp where sal not in (1500,3000,5000)
等价于
select * from emp where sal<> 1500 and sal<>3000 and sal<>5000

--数据库不等于有两种表示 != <>
--对或取反是并且 对并且取反是或

posted @ 2026-04-22 23:02  菜鸟的奋斗军  阅读(8)  评论(0)    收藏  举报