逻辑运算查询
逻辑运算符
and
: 多个条件同时成立or
: 任意一个条件成立not
: 取反操作
-- 查询年龄在18到28之间的学生信息
SELECT * FROM students WHERE age > 18 and age < 28;
-- 查询18岁以上的女性
SELECT * FROM students WHERE age > 18 and gender="女";
-- 18岁以上或者身高高过180(包括)以上
SELECT * FROM students WHERE age > 18 or height >=180;
-- 不在18岁以上的女性 这个范围内信息
SELECT * FROM students WHERE not(age > 18 and gender="女性");