MYSQL 3 class data types

Source: Internet
Author: User

1. Data type:

Bool,float,double

Decimal (m,d) M is the total number of decimal places (precision), andD is the number of digits following the point (Scale), and the maximum number of decimal integers (M) is 65.

smallint a small integer. The signed range is 32768 to 32767. The unsigned range is 0 to 65535.

Mediumint a medium-sized integer. The signed range is 8388608 to 8388607. The unsigned range is 0 to 16777215.

An integer of the normal size of int. The signed range is 2147483648 to 2147483647. The unsigned range is 0 to 4294967295.

Integer it is the meaning of int.

2, Time Type:

Date, the supported range is ' 1000-01-01 ' to ' 9999-12-31 '. MySQL Displays the date value in ' YYYY-MM-DD ' format, but allows a string or number to be used to assign a value to the date column.

Time

Timestamp, the range is ' 1970-01-01 00:00:00 ' to 2037 years.

If the data type of a column in a table is timestamp, insert update does not specify a value for it, it inserts the current time.

Example 1,

CREATE TABLE MyTable (X timestamp);

Insert into MyTable (X) values (null);

Select X from MyTable;

DateTime, is ' 1000-01-01 00:00:00 ' to ' 9999-12-31 23:59:59 '.

3. Character Type:

Char, the trailing space is deleted when the char value is retrieved, and the lenght maximum 255;char in char (length) is the consent word of char (1).

varchar, a shorthand for character varying. Save with a byte or two bytes long prefix + data. If the varchar column declaration is longer than 255, the length prefix is two bytes

Binary, type is similar to char type, but saves a binary byte string instead of a non-binary string.

varbinary, types are similar to varchar types, but save binary byte strings instead of non-binary strings.

Tinyblob, a BLOB column with a maximum length of 255 (28–1) bytes.

Example

Blob, a BLOB column with a maximum length of 65,535 (216–1) bytes.

Mediumblob, a BLOB column with a maximum length of 16,777,215 (224–1) bytes.

Longblob, a BLOB column with a maximum length of 4,294,967,295 or 4GB (232–1) bytes

Tinytext, the text column with a maximum length of 255 (28–1) characters.

Text, a text column with a maximum length of 65,535 (216–1) characters.

Mediumtext, a text column with a maximum length of 16,777,215 (224–1) bytes.

Longtext, a text column with a maximum length of 4,294,967,295 or 4GB (232–1) characters.

Enum ('value1', 'value2',...), enum type. There can be only one string of values, selected from the Value column 'value1', 'value2', ..., null or special ' error value '.

An enum column can have a maximum of 65,535 distinct values. The enum value is internally represented by an integer.

Set ('value1', 'value2',...), a setting. A string object can have 0 or more values, each value must come from the column value 'value1', 'value2', ...

The set column can have a maximum of 64 members. Set values are internally represented by integers.

MYSQL 3 class data types

Related Article

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.