比较运算符
> < <= >= <> !=
select * from employee where sex='male';
select * from employee where id>10;
select * from employee where salary between 10000 and 20000;
select * from employee where salary in (10000,20000); 单独的n个值
范围
between 10000 and 20000; 10000到20000之间
in (10000,20000) 只有10000或者20000
模糊匹配
like
% 通配符 表示任意长度的任意内容
_ 通配符 一个长度的任意内容
select * from employee where emp_name like '程__';
select * from employee where emp_name like 'j%';
select * from employee where emp_name like '%l%'; 含有l
regexp 必须是字符串
select * from employee where emp_name regexp '^j'; 以j开头的。
‘g$’ 以g结尾的
逻辑运算
not
select * from employee where salary not in (1000,20000) and age =18;
select * from employee where sex='male' or post='teacher';
and
or
not
查看岗位描述部位null
不能用= 只能用 is
select * from employee where post_comment is not null;