数据库优化之子查询优化

1. 案例 取所有不为掌门人的员工,按年龄分组! select age as '年龄', count(*) as '人数' from t_emp where id not in (select ceo from t_dept where ceo is not null) group by age; 如何优化? ①解决dept表的全表扫描,建立ceo字段的索引: 此时,再次查询: ②进一步优化,
相关文章
相关标签/搜索