Question: What is the difference between int(1) and tinyint(1)?With a design like this, I would never write int(1) anyway. I checked and found that after setting the storage type in MySQL, the storage is fixed-length, that is, We know that the int type occupies 4 bytes and tinyint occupies 1 byte. int(1) and int(4) are the same in terms of their length and storage method. The only difference is the displayed length. However, a parameter must be set: if Note that the number in parentheses after the numeric type does not indicate the length but the display width, which is different from the meaning of the number after varchar and char. That is to say In summary, no matter how many numbers are in the brackets of the integer data type, the storage space occupied is the same. tinyint 1 byte smallint 2 bytes MEDIUMINT 3 bytes Obviously, Summarize:
The above summary is a bit messy. Here is a brief summary:There is no difference between tinyint(1) and tinyint(3). They both occupy one byte and have the same storage range. Int(1) and tinyint(1), if sufficient, tinyint 1 byte smallint 2 bytes MEDIUMINT 3 bytes int 4 bytes BIGINT 8 bytes. However, the 5 in varchar(5) limits the number of characters that can be stored, regardless of their value (regardless of Chinese, English, numbers, etc.). The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Issues with Rancher deployment and importing K8S clusters
>>: Detailed explanation of TypeScript's basic types
After installing Navicat The following error may ...
Let me show you the effect picture first. Persona...
In the previous article, after configuring the we...
Linux remote deployment of MySQL database, for yo...
Table of contents 1. From father to son 2. Son to...
With the increasing number of open platforms, the ...
Relationship between MySQL and MariaDB MariaDB da...
Preface Hello everyone, this is the CSS wizard - ...
Cause of the problem: At first, the default yum s...
Preface Recently, a problem occurred in the test ...
Table of contents Common version introduction Com...
Table of contents history pushState() Method push...
Application scenario 1: Domain name-based redirec...
1. First log in to the Alibaba Cloud website to r...