In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The following mainly brings you what data types MySQL mainly has, hoping that these contents can bring you practical use, which is also the main purpose of my editing MySQL which data types this article has. Okay, no more nonsense, let's go straight to the following.
What is the data type?
Data types refer to the data characteristics of columns, stored procedure parameters, expressions, and local variables. They determine the storage format of data and represent different types of information.
Some data is to be stored as numbers, some of which are to be stored as integers, decimals, dates, etc.
MYSQL Common Data Types
MySQL supports multiple types, which can be roughly divided into four categories: numeric, floating point, date/time, and string (character) types.
1. Value type
MySQL supports all standard SQL numeric data types.
These numeric data types include strict numeric data types (INTEGER, SMALLINT, DECIMAL, and NUMERIC) and approximate numeric data types (FLOAT, REAL, and DOUBLE PRECISION).
The keyword INT is synonymous with INTEGER and the keyword DEC is synonymous with DECIMAL.
As an extension to the SQL standard, MySQL also supports integer types TINYINT, MEDIUMINT, and BIGINT. The following table shows the storage and range required for each integer type:
2. Floating point type
For example, we pay wages, usually with decimals.
Date and time types
Date and time types that represent time values are DATETIME, DATE, TIMESTAMP, TIME, and YEAR.
Each time type has a range of valid values and a value of "zero," which is used when specifying a value that illegal MySQL cannot represent.
The TIMESTAMP type has a proprietary automatic update feature, described later.
In production, date-time types are often used less, but numerical types are used instead of date types!
4 String types
String types are CHAR, VARCHAR, BINARY, VARBINARY, BLOB, TEXT, ENUM, and SET. This section describes how these types work and how to use them in queries.
CHAR and VARCHAR types are similar, but they are saved and retrieved differently. They also differ in maximum length and whether trailing spaces are preserved. Case conversion is not performed during storage or retrieval.
BINARY and VARBINARY classes are similar to CHAR and VARCHAR except that they contain binary strings instead of non-binary strings. That is, they contain byte strings rather than character strings. This means they have no character set and sort and compare numeric values based on column value bytes.
There are four types of TEXT: TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT. These correspond to four BLOB types with the same maximum length and storage requirements.
ENUM is an enumeration type
SET is a collection type different from ENUM type, which is a permutation combination. If there is abc, it can choose a or b or c, or ab,ac,bc, or abc.
summary
These data types can be used in data tables or stored procedures or later functions, that is, whenever data types are used, you can choose from any of the numeric, floating point, date/time, and string (character) types we just talked about.
For the above information about MySQL's main data types, do you think it is very helpful? If you need to know more, please continue to pay attention to our industry information, I believe you will like these contents.
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.