MySQL高级(五)、查询优化_create table if not exists `class` ( `id` int(10) -CSDN博客

网站介绍:文章浏览阅读377次。文章目录单表查询优化关联查询优化小表驱动大表OrderBy排序优化去重优化单表查询优化案例:有一张表为article表(文章表),表中的字段有文章id、category_id、评论数comments以及被看次数views,建表语句如下所示。现有需求如下,查询 category_id 为1 且 comments 大于 1 的情况下,views 最多的 article_id与author_id。CREATE TABLE IF NOT EXISTS `article` (`id` INT(10) UNS_create table if not exists `class` ( `id` int(10) unsigned not null auto_inc