您的位置:首页 > 博客中心 > 数据库 >

mysql校对规则引起的不区分大小写

时间:2022-03-13 22:56

CREATE TABLE `staticcatalogue` (
`Source` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT ‘‘,
`CreatedDate` datetime DEFAULT NULL,
`Val_tr` text CHARACTER SET utf8 COLLATE utf8_turkish_ci,
`Val_ro` text CHARACTER SET utf8 COLLATE utf8_romanian_ci,
`Val_gr` mediumtext CHARACTER SET greek,
`Val_ar` mediumtext CHARACTER SET cp1256,
`Val_fr` mediumtext CHARACTER SET utf8 COLLATE utf8_unicode_ci,
PRIMARY KEY (`Source`),
KEY `PermissionID` (`PermissionID`),
CONSTRAINT `staticcatalogue_ibfk_1` FOREIGN KEY (`PermissionID`) REFERENCES `permission` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=‘Static language catalogue‘

这个创建表的SQL语句里包含了很多的校对规则,当与其他表连接进行查询的时候,Source字段会区分大小写,其他字段的校对是....._ci,是不区分大小写的。若要比较时Source不区分大小写可以再比较语句后添加COLLATE utf8_general_ci,如......LEFT JOIN staticcatalogue x2 ON x2.Source = c.Name COLLATE utf8_general_ci

mysql默认是不区分大小写的。查看一个表的详细信息可以使用命令: show create table talename.

mysql校对规则引起的不区分大小写,布布扣,bubuko.com

热门排行

今日推荐

热门手游