MySQL Data Type

Source: Internet
Author: User

MySQL Data Type

Value Type
INTEGER (tinyint, smallint, int, bigint, mediumint ,)
For integer types, there are three attributes: unsigned, zerofill (formatted output during query), auto_increment

Float Type (float 4, double 8, real, double precision)
Count (decimal, numeric) m + 2
Declimal -- 1. When the value of the inserted integer part exceeds the indicated range, the value of the fractional part is directly ignored and filled with the maximum value.
-- 2. If the integer part is valid and the decimal part is redundant, It is truncated directly.

Unsigned is a non-negative number. You can use this type to increase the data length! For example, if the maximum value of tinyint is 127, the maximum value of tinyint unsigned can be 127*2. the unsigned attribute is only applicable to integer data.
Bit (1 ~ 8) bytes

Time Type
Datetime 8B [1000-1-1 00:00:00 9999-12-31 23:59:59]
Date 4B
Time 3B
Year 1B
Timestamp 4B (only one table can be created)
Generally, the value is caused ''.
01:02:03 will be automatically converted

String type
Char, varchar, enum, set character, length

Char (13) is fixed in length. For example, the storage space of 'www .jb51.net' must be 12 characters long.
Varchar (13) Variable Length: for example, 'www .jb51.net' requires a bucket of 13 characters,
In a char (M) data column, each value occupies M bytes. If the length of a data column is smaller than M, MySQL uses space characters on the right side of the data column. (The space characters filled in the search operation will be removed.) In the varchar (L) data column,
Each value takes only enough bytes and adds a byte to record its length (that is, the total length is L + 1 bytes)
If you enter "" in both types at the same time, there are two spaces after reading the content in char. The space will be omitted because mysql will read the space at the end. the system is designed to supplement the configuration. While when reading varchar, there will be spaces after the "New Year's Eve.

For some reason, char has a fixed length, so the processing speed is much faster than that of varchar, but the storage space is not large, however, if the speed requirement is met, the char type can be used. Otherwise, the varchar type can be used for instances.

Data Export
Data export can be performed in the following ways:
Use the select into outfile "filename" Statement
Use the mysqldump Utility
Use the select into outfile "filename" Statement

A relational database is a two-dimensional table model. Therefore, a relational database is a data organization composed of two-dimensional tables and their relationships.
Currently, mainstream relational databases include Oracle, DB2, Microsoft SQL Server, Microsoft Access, and MySQL.

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.