In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article shows you what MySQL field types are, which are concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
1. Date and time data type
MySQL data type meaning date3 bytes, date, format: 2014-09-18time3 bytes, time, format: 08:42:30datetime8 bytes, date time, format: 2014-09-18 08:42:30timestamp4 bytes, automatic storage record modified time year1 bytes, year
two。 Numeric data type
Integer type
MySQL data type meaning (signed) tinyint1 bytes, range (- 128 '127) smallint2 bytes, range (- 32768' 32767) mediumint3 bytes, range (- 8388608 '8388607) int4 bytes, range (- 2147483648' 2147483647) bigint8 bytes, range (+-9.22'10 to the power of 18)
The above definitions are all signed. Of course, you can also add the unsigned keyword to define the unsigned type, and the corresponding value range will be flipped, such as:
The value range of tinyint unsigned is 0,255.
Floating point type
MySQL data type meaning float (m, d) 4 bytes, single precision floating point type, m total number, d decimal place double (m, d) 8 bytes, double precision floating point type, m total number, d decimal place decimal (m, d) decimal is a floating point number stored as a string
I set up a table in MySQL with a list of float (5, 3); I did the following experiments:
1. Insert 123.45678, and the final query result is 99.999.
two。 Insert 123.456, and the final query result is 99.999
3. Insert 12.34567, and the final query result is 12.346
Therefore, when using floating-point types, you should pay attention to the pitfalls, depending on the actual results inserted into the database.
3. String data type
MySQL data type meaning char (n) fixed length, up to 255characters varchar (n) variable length, up to 65535 characters tinytext variable length, up to 255character text variable length, up to 65535 character mediumtext variable length, up to 2 to the power of 24-1 character longtext variable length, up to 2 to the power of 32-1 character
N in parentheses in 1.char (n) and varchar (n) represents the number of characters, not the number of bytes, so when Chinese is used (UTF8) means that m Chinese characters can be inserted, but it actually takes up 3 bytes.
two。 At the same time, the biggest difference between char and varchar is that char will occupy n characters regardless of the actual value, while varchar will only occupy + 1 of the space that the actual characters should occupy, and the actual space + 1.
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
Select to_date ('2005-12-25 Person13-25-5-5-5-5) from dual
© 2024 shulou.com SLNews company. All rights reserved.