@轻描淡写 对 MySQL 5.7.19,Mariadb12,MySQL8.0.13 测试后都是这样。
CREATE TABLE `tbla` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`age` INT(11) NULL DEFAULT NULL,
`birth` TIMESTAMP NOT NULL,
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
INDEX `indx_A_ageBirth` (`age`, `birth`)
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=4
;
//
desc select * from tbla where age > '20' order by 'created_at'
//
desc select * from tbla where age > '20' order by created_at
加引号

不加引号
都没有
filesort
啊5.7.26
@轻描淡写 对 MySQL 5.7.19,Mariadb12,MySQL8.0.13 测试后都是这样。
看看结果
使用 id order by,测试时,加上单引号后, 还能影响所使用的索引
:dizzy_face:你们在一本正经讨论什么啊。。数据库要么不加`表示字段,要么用``包裹字段,单引号是字符串不是字段。你order by 'xxxxx'等于没有order by
@FreeMason 你的引号打错了 应该是是 tab 键上面的那个符号