and操作符
select * from tb_student where studentage<=100 and studentid<=20;
or操作符
select * from tb_student where studentage<=100 OR studentsex=‘女’;
如果and or 同时使用,那么and的优先性高于or.
in操作符
select * from tb_student where studentid in(1,10);
in 和or具有相同的功能。但是in的优点在于:
1.使用长的合法选项清单时,in 的语法更加清楚,直观。
2.使用in时,计算的次序更加容易管理。
3.in最大的优点是可以包含其他select语句,动态建立where语句。
not操作符
select * from tb_student where studentid not in(100,12);