当前位置:网站首页>The difference between int (1) and int (10)
The difference between int (1) and int (10)
2022-07-04 01:59:00 【South wind knows easy***】
We know that mysql in int Occupy 4 Bytes , So for unsigned int, The maximum is 2^32-1 = 4294967295, nearly 40 Billion , Did you use it int(1), Can't you reach this maximum ?
CREATE TABLE `user` (
`id` int(1) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
id The field is unsigned int(1), Let me insert a maximum to see .
mysql> INSERT INTO `user` (`id`) VALUES (4294967295);
Query OK, 1 row affected (0.00 sec)
You can see the success , explain int Back number , No effect int Size supported by itself ,int(1)、int(2)…int(10) No difference .
commonly int Back number , coordination zerofill It works when used together . Let's take an example :
CREATE TABLE `user` (
`id` int(4) unsigned zerofill NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
mysql> INSERT INTO `user` (`id`) VALUES (1),(10),(100),(1000);
Query OK, 4 rows affected (0.00 sec)
Records: 4 Duplicates: 0 Warnings: 0
Insert separately 1、10、100、1000 4 Data , Then let's check :
mysql> select * from user;
+------+
| id |
+------+
| 0001 |
| 0010 |
| 0100 |
| 1000 |
+------+
4 rows in set (0.00 sec)
Through the data, we can find int(4) + zerofill Realized the deficiency 4 Place complement 0 The phenomenon of , only int(4) It's no use .
边栏推荐
- Properties of binary trees (numerical aspects)
- Why can't it run (unresolved)
- When the watch system of Jerry's is abnormal, it is used to restore the system [chapter]
- Skku| autonomous handover decision of UAV Based on deep reinforcement learning
- 2022 electrician (elementary) examination question bank and electrician (elementary) simulation examination question bank
- Applet graduation project is based on wechat classroom laboratory reservation applet graduation project opening report function reference
- Yyds dry goods inventory it's not easy to say I love you | use the minimum web API to upload files
- MySQL deadly serial question 2 -- are you familiar with MySQL index?
- [turn] solve the problem of "RSA public key not find" appearing in Navicat premium 15 registration
- Remember a lazy query error
猜你喜欢
Install the pit that the electron has stepped on
Write the first CUDA program
Solution of cursor thickening
Openbionics exoskeleton project introduction | bciduino community finishing
After listening to the system clear message notification, Jerry informed the device side to delete the message [article]
Make drop-down menu
Remember another interview trip to Ali, which ends on three sides
The contact data on Jerry's management device supports reading and updating operations [articles]
C import Xls data method summary II (save the uploaded file to the DataTable instance object)
When the watch system of Jerry's is abnormal, it is used to restore the system [chapter]
随机推荐
Properties of binary trees (numerical aspects)
Skku| autonomous handover decision of UAV Based on deep reinforcement learning
求esp32C3板子連接mssql方法
Example 073 square sum value judgment programming requires the input of a and B, if a ²+ b ² If the result of is greater than 100, a is output ²+ b ² Value, otherwise output the result of a + B.
How programmers find girlfriends through blind dates
Chapter 3.4: starrocks data import - Flink connector and CDC second level data synchronization
Should enterprises start building progressive web applications?
Servlet simple verification code generation
Development of user-defined navigation bar in uniapp
Pyinstaller packaging py script warning:lib not found and other related issues
Bacteriostatic circle scanning correction template
[turn] solve the problem of "RSA public key not find" appearing in Navicat premium 15 registration
Applet graduation project is based on wechat classroom laboratory reservation applet graduation project opening report function reference
Meta metauniverse female safety problems occur frequently. How to solve the related problems in the metauniverse?
Will the memory of ParticleSystem be affected by maxparticles
All ceramic crowns - current market situation and future development trend
Iclr2022 | ontoprotein: protein pre training integrated with gene ontology knowledge
Small program graduation project based on wechat examination small program graduation project opening report function reference
Idsia & supsi & usi | continuous control behavior learning and adaptive robot operation based on Reinforcement Learning
A. ABC