7 where 约束条件 / 正则查询

#where

select id,name,age from employee where id>7;

select id,name,post,salary from employee where  post='teacher' and salary>8000;

select name,salary from employee where salary >=20000 and salary <= 30000;

select name, salary from employee where salary between 20000 and 30000;

select name, salary from employee where salary<20000 or salary>30000;

select name, salary from employee where salary not between 20000 and 30000;

select * from employee where age in(73,81,88);

select * from employee where post_comment is Null;

select * from employee where post_comment is not Null;

select * from employee where name like 'jin%';   #模糊匹配

select * from employee where name like 'jin___';

 

 

#正则查询

 

select * from employee where name regexp '^jin.*(g|n)$';

  

你可能感兴趣的:(7 where 约束条件 / 正则查询)