美文网首页
索引下推

索引下推

作者: wuyuan0127 | 来源:发表于2024-01-21 15:19 被阅读0次

    1. create table

        CREATE TABLE `demo` (

    `id` BIGINT(11) UNSIGNED NOT NULL AUTO_INCREMENT,

    `name` VARCHAR(10) NULL DEFAULT '' COLLATE 'utf8mb4_general_ci',

    `address` VARCHAR(10) NULL DEFAULT '' COLLATE 'utf8mb4_general_ci',

    `status` TINYINT(1) NULL DEFAULT '1',

    `num` INT(10) NULL DEFAULT '0',

    PRIMARY KEY (`id`) USING BTREE,

    INDEX `ix_pnnc` (`status`, `address`, `name`) USING BTREE

    )

    COLLATE='utf8mb4_general_ci'

    ENGINE=InnoDB

    ROW_FORMAT=COMPACT

    ;

    2. query sql:

    explain SELECT * FROM demo WHERE `status`=1 AND `name` LIKE '%小红%' AND address='beijing'

    相关文章

      网友评论

          本文标题:索引下推

          本文链接:https://www.haomeiwen.com/subject/jbyeodtx.html