4.分页查询
(0) 基础
select 查询列表
from 表
...
limit offset,size;
offset:要显示条目的起始索引,从0开始
size:显示数量
语句放最后使用
(1) 使用
select *
from employees
limit 0,5;
5.联合查询
(0) 基础
将多个查询结果合并成一个结果
select 语句1
union
select 语句2
union
select 语句3
...
特点:
要求列数一致、顺序一致、类型一致
union默认去重
使用union all 保证不去重
(1) 使用
# 查询部门编号>90 或者邮箱包含a的员工信息
select * from employees where email like '%a%' or department_id>90;
select * from employees where email like '%a%'
union
select * from employees where department_id>90;