Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the mysql data types

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces what the mysql data types are, which are very detailed and have certain reference value. Friends who are interested must finish reading them.

The first step is to understand the data types it supports. Mysql supports all standard sql data types, including three types: numeric, date, and string.

1. Numerical type

Numeric types include integer types, fixed-point types, floating-point types, and bit-value types. Let's look at integer types first.

Integer type

One of the most commonly used is int.

Fixed-point type

The DECIMAL and NUMERIC types store precise numeric data values. You can use these types when you need to maintain precision, such as currency data. In MySQL, the NUMERIC implementation is DECIMAL.

Floating point type

The float and double types represent approximate numeric data values. MySQL uses 4 bytes for single precision values and 8 bytes for double precision values.

Bit value type

The bit data type is used to store bit values. The type of bit (M) allows you to store M-bit values. M ranges from 1 to 64.

II. Date type

DATE, date. The range of support is' 1000-01-01'to '9999-12-31'.

DATETIME, a combination of date and time. The range of support is from '1000-01-01 00' to '9999-12-31 23 59'.

TIMESTAMP [(M)], timestamp. The TIMESTAMP value is returned and displayed as a string in 'YYYY-MM-DD HH:MM:SS' format, with a fixed display width of 19 characters.

TIME, time. The range is'- 838 / 59 / 59 to '838 / 59 / 59 / 5.

YEAR [(2 | 4)], the year in two-or four-digit format. The default is a four-digit format. In a four-bit format, the allowed values are 1901 to 2155 and 0000. In the two-bit format, the allowed values are 70 to 69, representing the period from 1970 to 2069.

3. String type

String data types are char, varchar, and TEXT.

Character data is data consisting of any combination of letters, symbols, and numbers.

Varchar is variable-length character data whose length does not exceed 8kb. Char is fixed-length character data with a maximum length of 8kb. ASCII data that exceeds 8kb can be stored using a text data type.

The above is all the content of the article "what are the mysql data types?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report