当前位置:网站首页>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 .
边栏推荐
- LV1 previous life archives
- After listening to the system clear message notification, Jerry informed the device side to delete the message [article]
- Pytoch residual network RESNET
- SRCNN:Learning a Deep Convolutional Network for Image Super-Resolution
- Flex flexible layout, box in the middle of the page
- Three layer switching ②
- MySQL advanced (Advanced) SQL statement (I)
- Learn these super practical Google browser skills, girls casually flirt
- String & memory function (detailed explanation)
- The automatic control system of pump station has powerful functions and diverse application scenarios
猜你喜欢

How to delete MySQL components using xshell7?

The automatic control system of pump station has powerful functions and diverse application scenarios
![[turn] solve the problem of](/img/c2/368582a8ed26254409fe391899ba41.jpg)
[turn] solve the problem of "RSA public key not find" appearing in Navicat premium 15 registration

Should enterprises start building progressive web applications?

How programmers find girlfriends through blind dates

LV1 tire pressure monitoring

Small program graduation design is based on wechat order takeout small program graduation design opening report function reference

What is the student party's Bluetooth headset recommendation? Student party easy to use Bluetooth headset recommended

MPLS③

Yyds dry goods inventory hand-in-hand teach you the development of Tiktok series video batch Downloader
随机推荐
2020-12-02 SSM advanced integration Shang Silicon Valley
From the 18th line to the first line, the new story of the network security industry
LeetCode 168. Detailed explanation of Excel list name
Experimental animal models - current market situation and future development trend
2022 electrician (elementary) examination question bank and electrician (elementary) simulation examination question bank
IPv6 experiment
Gnupg website
Yyds dry goods inventory hand-in-hand teach you the development of Tiktok series video batch Downloader
Description of setting items of Jerry [chapter]
Push technology practice | master these two tuning skills to speed up tidb performance a thousand times!
Solution to the problem that jsp language cannot be recognized in idea
Three layer switching ①
Make drop-down menu
mysql使用視圖報錯,EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
Feign implements dynamic URL
Yyds dry goods inventory override and virtual of classes in C
Writeup (real questions and analysis of ciscn over the years) of the preliminary competition of national college students' information security competition
Maximum entropy model
求esp32C3板子連接mssql方法
Use classname to modify style properties