Simple data type differences and realizations of MySQL

Source: Internet
Author: User

Date 3 bytes, dates, format: 2014-09-18
Time 3 bytes, duration, format: 08:42:30
DateTime 8 Bytes, datetime, format: 2014-09-18 08:42:30
Timestamp 4 bytes, automatically stores the time the record was modified

Year 1 bytes, years
Tinyint 1 bytes, range ( -128~127)
SmallInt 2 bytes, range ( -32768~32767)
Mediumint 3 bytes, range ( -8388608~8388607)
int 4 byte, range ( -2147483648~2147483647)
BigInt 8 bytes, range (+-9.22*10 18-square)

Float (M, D) 4 bytes, single-precision floating-point, M total, D-Decimal
Double (M, D) 8 bytes, double-precision floating point, m total number, D decimal place
Decimal (M, d) decimal is a floating-point number stored as a string

char (n) fixed length, up to 255 characters
varchar (n) variable length, up to 65,535 characters
(The biggest difference between char and varchar is that char, regardless of the actual value, will occupy N-character space,
The varchar only occupies +1 of the space that the actual character should occupy, and the actual space is +1<=n. )

Tinytext variable length, up to 255 characters
Text variable length, up to 65,535 characters
Mediumtext variable length, up to 2 of 24 square-1 characters
Longtext variable length, up to 2 of 32 square-1 characters

*/index simple and easy to use indexing method.

Simple data type differences and realizations of MySQL

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.