select * from test_student where s_id != 1; select * from test_student where s_id ^= 1; select * from test_student where s_id <> 1;
②小于:(<),大于(>),小于等于(<=),大于等于(>=),
select * from test_student where s_id < 1; select * from test_student where s_id > 1; select * from test_student where s_id <= 1; select * from test_student where s_id >= 1;
③在列表(in),不在列表(not in),
注意:例如in,则记录只能选s_id = 3 和 5;
select * from test_student where s_id in (3,5); select * from test_student where s_id not in (3,5);
④介于…之间(between…and),不介于…之间(not between…and),
⑤是否为空(is null),不为空(is not null),
⑥模式匹配(like)。
(3)逻辑操作符:
① or(或)
② and(与)
③ not(非)
(4)集合操作符:
① union(并集) union连接两句sql语句, 两句sql语句的和 去掉重复的记录。
② union all(并集) 接两句sql语句,两句sql语句的和不用去掉重复的记录。
③ intersect (交集) Intersect连接两句sql语句 取查询出来的两个集合的 共同部分。
④ minus (补集) Minus 连接两句sql 语句,取查询出来的两个集合的差。
连接操作符: (||) 用来连接连个字段,或者将多个字符串连接起来。 操作符的优先级别:算术》连接》比较》逻辑(not and or)