1.simple 简单查询。查询不包含子查询和union,我们碰到的大部分查询都是简单查询。

 

mysql的查询种类

 

 

执行以下sql语句:

explain select (select 1 from actor where id = 1) from
(select * from film where id = 1
union
select * from film where id = 1
) der;

会出现另外5中查询类型

#2.primary:复杂查询中最外层的 select(explain后面的第一个select)
#3.derived:包含在 from 子句中的子查询。MySQL会将结果存放在一个临时表中,也称为派生表(derived的英文含义)
#4.union:在 union 中的第二个和随后的 select,使用union关键字时,因为是临时表,所以无法使用索引,查询效率会比较低
#5.union result:从 union 临时表检索结果的 select
#6.subquery:包含在 select 中的子查询(不在 from 子句中)

mysql的查询种类

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
  • 2021-06-09
  • 2022-12-23
猜你喜欢
  • 2021-09-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2022-02-09
相关资源
相似解决方案