示例表:
CREATE TABLE `t_employees` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(24) NOT NULL DEFAULT '' COMMENT '姓名',
`age` int(11) NOT NULL DEFAULT '0' COMMENT '年龄',
`position` varchar(20) NOT NULL DEFAULT '' COMMENT '职位',
`hire_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '入职时间',
PRIMARY KEY (`id`),
KEY `idx_name_age_position` (`name`,`age`,`position`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='员工记录表';
INSERT INTO t_employees(name,age,position,hire_time) VALUES('LiLei',22,'manager',NOW());
INSERT INTO t_employees(name,age,position,hire_time) VALUES('HanMeimei',23,'dev',NOW());
INSERT INTO t_employees(name,age,position,hire_time) VALUES('Lucy',23,'dev',NOW());
‐‐ 插入一些示例数据
drop procedure if exists insert_emp
《MySQL》第四篇 MySQL如何选择合适的索引
于 2021-11-23 09:01:34 首次发布