说明
逻辑运算符用于关联多个条件
and
多个条件同时满足
例子
查询年龄等于20并且密码等于”123456”的用户
select * from tb_user where age = 20 and password = '123456';
or
多个条件其中一个满足
例子
查询用户编号大于6或者年龄等于20的用户
select * from tb_user where id > 6 or age = 20;
not
不满足,取反,否定它之后所跟的任何条件
可以使用 not 运算符对 in、between and、exists 子句进行取反
例子
查询用户编号不是1、3、5、7的用户
select * from tb_user where id not in (1, 3, 5, 7);
