当前位置:网站首页>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

边栏推荐
- How to view the data mini map quickly and conveniently after importing data in origin
- GAN Inversion: A Survey
- install opencv-contrib-dev to use aruco code
- Solve Django's if Version (1, 3, 3): raise improverlyconfigured ('mysqlclient 1.3.3 or new is required
- Joint Noise-Tolerant Learning and Meta Camera Shift Adaptation for Unsupervised Person Re-ID
- thinkphp5使用composer安装插件提示php版本过高
- QPM suspended window setting information
- 2021年全国职业院校技能大赛(中职组)网络安全竞赛试题(1)详细解析教程
- Pycharm [debug] process stuck
- 2021-11-22 运动规划杂记
猜你喜欢

《一周搞定模电》—功率放大器

A Style-Based Generator Architecture for Generative Adversarial Networks

VI summary of common commands

"One week's work on Analog Electronics" - power amplifier

thinkphp5手动报错

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

kubernetes集群部署(v1.23.5)

【Sensors 2021】Relation-Based Deep Attention Network with Hybrid Memory for One-Shot Person Re-Id

Param in the paper

Merrill Lynch data technology expert team | application of recommendation of relevant contents in group system data retrieval
随机推荐
MATLAB basic operation command
节流,防抖,new函数,柯里化
pcl install
Classified catalogue of high quality sci-tech periodicals in the field of computing
【CVPR 2021】Intra-Inter Camera Similarity for Unsupervised Person Re-Identification (IICS++)
"One week's work on Analog Electronics" - integrated operational amplifier
Detectron2 outputs validation loss during training
mysql 数据库字段查询区分大小写设置
Collection object replication
Analysis of ROS calculation diagram level
我的创作纪念日
SQL 函数
OpenCV depthframe -> pointcloud 导致 segmentation fault!
Behavior tree file description
Comparison of similar PMS in QPM
十万行事务锁,开了眼界了。
There is a strong demand for enterprise level data integration services. How to find a breakthrough for optimization?
Merrill Lynch data helps State Grid Hubei "golden eye" accurately identify abnormal power consumption
Logview Pro can be used if the log is too large
【CVPR 2021】 Lifelong Person Re-Identification via Adaptive Knowledge Accumulation