In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail what is the difference between int and bigint in mysql. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
1 bytes = 8 bit, the maximum length of data that can be represented by a byte is 2 to the eighth power of 11111111 in a computer.
1.BIT [M]
Bit field type, M represents the number of digits for each value, ranging from 1 to 64, and defaults to 1 if M is ignored.
2.TINYINT [(M)] [UNSIGNED] [ZEROFILL] M defaults to 4
A very small integer. The signed range is-128 to 127. The unsigned range is 0 to 255.
3. BOOL,BOOLEAN
Is a synonym for TINYINT (1). The Zero value is considered false. A non-zero value is regarded as true.
4.SMALLINT [(M)] [UNSIGNED] [ZEROFILL] M defaults to 6
A small integer. The signed range is-32768 to 32767. The unsigned range is 0 to 65535.
5.MEDIUMINT [(M)] [UNSIGNED] [ZEROFILL] M defaults to 9
A medium-sized integer. The signed range is-8388608 to 8388607. The unsigned range is 0 to 16777215.
6. INT [(M)] [UNSIGNED] [ZEROFILL] M defaults to 11
An integer of normal size. The signed range is-2147483648 to 2147483647. The unsigned range is 0 to 4294967295.
7.BIGINT [(M)] [UNSIGNED] [ZEROFILL] M defaults to 20
Large integers. The signed range is-9223372036854775808 to 9223372036854775807. The unsigned range is 0 to 18446744073709551615.
Note: M here does not represent the specific length stored in the database, used to mistakenly think that int (3) can only store 3-length numbers, int (11) will store 11-length numbers, this is a big mistake.
1 and 4 in tinyint (1) and tinyint (4) do not indicate storage length, only fields that specify zerofill are useful, such as tinyint (4), if the actual value is 2, if the column specifies zerofill, the query result is 0002, populated with 0 on the left.
Char is a fixed-length type, while varchar is a variable-length type. The difference between them is:
In the char (M) type data column, each value takes up M bytes. If a length is less than M ~ (M), MySQL will fill it with a space character on the right. (those filled-in space characters will be removed in the retrieval operation)
In data columns of type varchar (M), each value occupies just enough bytes plus a byte used to record its length (that is, the total length is 1 byte).
The rules used in MySQL to determine whether data column type conversion is required:
1. In a data table, if the length of each data column is fixed, then the length of each data row will also be fixed.
2. As long as there is a variable length of a data column in the data table, the length of each data row is variable.
3. If the length of a data row in a data table is variable, then, in order to save storage space, MySQL will convert the fixed-length data columns in the data table to the corresponding variable-length type.
Exception: char data columns that are less than 4 characters in length are not converted to varchar types.
So much for sharing what is the difference between int and bigint in mysql. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.