Why is this happening? Who can tell me?

CREATE TABLE `user` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(20) CHARACTER SET latin1 DEFAULT NULL,
`simuid` varchar(50) CHARACTER SET latin1 NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;

INSERT INTO `user` (`id`, `name`, `simuid`)
VALUES
(1, 'ccc', '6441760021201308940'),
(3, 'bb', '6441760021201308941'),
(4, 'bb', '6441760021201308942');

select * from user where simuid = 6441760021201308940;
result:
1 ccc 6441760021201308940
3 bb 6441760021201308941
4 bb 6441760021201308942

but :select * from user where simuid = '6441760021201308940';
result:
1 ccc 6441760021201308940

This will happen if the value is greater than 6441760021201308160. My version is 8.x, I don’t know if it will be the same for other versions



Read more here: https://stackoverflow.com/questions/64399681/why-is-this-happening-who-can-tell-me

Content Attribution

This content was originally published by mz c at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: