这个错误我的想法我有这张桌子
CREATE TABLE `t_slot` (
`id` int unsigned NOT NULL,
`uid` int unsigned NOT NULL,
`code` char(9) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`pType` tinyint unsigned NOT NULL,
`pos` tinyint unsigned DEFAULT NULL,
`pid` int unsigned DEFAULT NULL,
`lChild` int unsigned DEFAULT NULL,
`rChild` int unsigned DEFAULT NULL,
`encodeTime` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
然后我试着做这样的查询
SELECT * FROM t_slot WHERE code = 5;
令人惊讶的是,它匹配 1 行的值为
mysql> select * from t_slot where code = 5;
+----+-----+-----------+-------+------+------+--------+--------+---------------------+
| id | uid | code | pType | pos | pid | lChild | rChild | encodeTime |
+----+-----+-----------+-------+------+------+--------+--------+---------------------+
| 2 | 4 | 5FPSLB-BP | 40 | 0 | 1 | 3 | 5 | 2022-03-19 17:39:03 |
+----+-----+-----------+-------+------+------+--------+--------+---------------------+
1 row in set, 50 warnings (0.00 sec)
并收到此警告
mysql> show warnings;
+---------+------+-----------------------------------------------+
| Level | Code | Message |
+---------+------+-----------------------------------------------+
| Warning | 1292 | Truncated incorrect DOUBLE value: 'Y8VHM9-BP' |
| Warning | 1292 | Truncated incorrect DOUBLE value: '5FPSLB-BP' |
| Warning | 1292 | Truncated incorrect DOUBLE value: 'HBV29S-BP' |
... etc
我真的没想到 5 会与5FPSLB-BP
.
5怎么等于5FPSLB-BP
。