阅读背景:

5.1 索引单表优化案例

来源:互联网 

1、案例

create TABLE if not EXISTS `article`(
	`id` int(10) UNSIGNED not null primary key auto_increment,
	`author_id` int(10) UNSIGNED not null,
	`category_id` int(10) UNSIGNED not null,
	`views` int(10) UNSIGNED not null,
	`comments` int(10) UNSIGNED not null,
	`title` VARCHAR(255) not null,
	`content` TEXT not null
);

INSERT into `article`(`author_id`,`category_id`,`views`,`comments`,`title`,`content`) VALUES
(1,1,1,1,'1','1'),
(2,2,2,2,'2','2'),
(1,1,3,3,'3','3');

#查询category_id 为1 且comments 大于1 的情况下,views最多的情况下的article_id。
create TABLE if not EXISTS `article`



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: