1、where字句
用来添加要查询的条件
语法:select *
from 表名
where 查询的条件
比较运算符
>,<,=,<=,>=,!=
2、逻辑运算符
and,or
一般数据库先进行and的运算,再进行or的运算
3、其他运算符
in() 包含意思,可以取多个值,用逗号隔开,里面的关系是or,取几个值就几个结果
not in() 不包含意思,里面的关系是and,取几个值就把这几个值都去掉
between 2 and 6 全闭空间 相当于 >=2 and <=6
is null 是空值
is not null 不是空值
4、模糊查询
like
通配符 % _
--查询名字是以M打头的员工;
select * from s_emp where first_name like 'M%';
--查出姓名中第三个字母是e的员工;
select * from s_emp where first_name like '__e%';
5、排列
order by 列名 asc(升序,默认可以不写)| desc(降序)