回表
Mysql回表指的是在InnoDB存储引擎下,二级索引查询到的索引列,如果需要查找所有列的数据,则需要到主键索引里面去取出数据。这个过程就称为回表。因为行的数据都是存在主键B+tree的叶子节点里面,二级索引的B+树叶子节点都是存放的(索引列,主键)。
例如:
有一张用户表 id(主键), username (二级索引),age
id是主键索引 username是二级索引,当我们通过二级索引查询返回记录时,例如:
select * from t where userna
前言
出现这种bugUnit mysql.service could not be found
因为bug被我修复好了,在这里引用一下网友的bug截图
1. 原理
之所以使用命令行service mysqld status出现Unit mysql.service could not be found的bug
原因如下: 安装好了mysql之后 发现在init.d的配置中没有mysql的服务 所以使用service mysqld status,就会因为其找不到mysql或者m
1. select * from student s where s.id in (20,30);
查询id是20或者是30,等同于select * from student s where s.id = 20 or s.id = 30;
2.select * from student s where s.id in (select age from student);
查询id是age数组里面的,单个字段只能in查询结果是单行的。
很明显后面括号的 select age from