当前位置:网站首页>Mysql database field query case sensitive setting
Mysql database field query case sensitive setting
2022-06-26 09:38:00 【A constant stream of cars】
Use navicat Create database , Character set selection utf8, If the sorting rule is not selected , Create successful session , Check the database properties and find that the sorting rules are set by default, as shown in the following figure :

Once created , Create table testcase, adopt show CREATE TABLE testcase View the table creation statement , The following are not case sensitive [ Sort rule :utf8_genera_ci Case insensitive ]
CREATE TABLE `testcase` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`time` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
INSERT INTO `testcase` ( `name`, `time`) VALUES ('WX0001', '2022-06-22');
INSERT INTO `testcase` ( `name`, `time`) VALUES ('wx0001', '2022-06-22');
Insert the statement above , Because it's not case sensitive , With a unique index field name Failed to insert the second record of

Modify table character set
ALTER TABLE testcase CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
utf8_bin Store every character in the string in binary data , Case sensitive
How many rows does the database currently have , How many lines will be affected
CREATE TABLE `testcase` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`time` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_bin
After modification , Insert the lowercase field value that just failed again
INSERT INTO `testcase` ( `name`, `time`) VALUES ('wx0001', '2022-06-22');
You can see that the insertion was successful , Case sensitivity is set successfully

边栏推荐
- PHP extracts TXT text to store the domain name in JSON data
- Explained: A Style-Based Generator Architecture for GANs (StyleGAN)
- Learning to Generalize Unseen Domains via Memory-based Multi-Source Meta-Learning for Person Re-ID
- Function function of gather()
- Detectron2 save (according to maxap50) model during training_ best. PTH weight
- 《一周搞定模电》-二极管
- Jz2440 - - - utiliser le programme de gravure uboot
- GAN Inversion: A Survey
- logback
- 【CVPR 2021】Joint Generative and Contrastive Learning for Unsupervised Person Re-identification
猜你喜欢

Explained: A Style-Based Generator Architecture for GANs (StyleGAN)

"One week's work on digital power" -- encoder and decoder

2021年全国职业院校技能大赛(中职组)网络安全竞赛试题(1)详细解析教程

板端电源硬件调试BUG

xsync同步脚本的创建及使用(以Debian10集群为例)

Curriculum learning (CL)

Practice of production control | dilemma on assembly rack

Joint Noise-Tolerant Learning and Meta Camera Shift Adaptation for Unsupervised Person Re-ID

Thinkphp5 manual error reporting

MapReduce&Yarn理论
随机推荐
PHP extracts TXT text to store the domain name in JSON data
xsync同步脚本的创建及使用(以Debian10集群为例)
mysql 数据库字段查询区分大小写设置
"One week's solution to analog electricity" - power circuit
online trajectory generation
Merrill Lynch data technology expert team | application of recommendation of relevant contents in group system data retrieval
Board end power hardware debugging bug
Logview Pro can be used if the log is too large
Regular expression learning
Badge collection 6:api\_ Use of level
install opencv-contrib-dev to use aruco code
Super data processing operator helps you finish data processing quickly
Detectron2 outputs validation loss during training
OpenCV depthframe -> pointcloud 导致 segmentation fault!
How to correctly open the USB debugging and complete log functions of Huawei mobile phones?
Solve Django's if Version (1, 3, 3): raise improverlyconfigured ('mysqlclient 1.3.3 or new is required
thinkphp5手动报错
Badge series 8: generate a personalized Badge
【CVPR 2021】DatasetGAN: Efficient Labeled Data Factory with Minimal Human Effort
"One week's work on digital power" -- encoder and decoder