Database-Data type

Source: Internet
Author: User

1. mysql data types include: integer type, floating-point type, fixed-point number type, date-time type, string type, binary type;

2, integer type denotes integers, floating-point numbers and fixed-points represent decimals, and datetime types represent time;

3. String type
Char: You need to specify a fixed length when creating, the value 0-255, each data must occupy a specified length of space, the advantage is the query data fast;
VARCHAR: You need to specify a fixed length when creating, the value 0-65535, if the specified varchar (100) length is 100, when a field length of only 27 o'clock, in the database of the field only 28 bytes (string actual length + 1), so that the system space can be saved;
Blob:
Text: Special string type, text can only hold character data, including Tinytext/text/mediumtext/longtext
Enum: Enum, controls the range of data inserted, can only select a value in the table, enumeration has 65,535
Set: Collection, select the data to be inserted from the specified collection, the collection can have 64 values

4. Binary type
Binary: You need to specify a fixed length at the time of creation, value 0-255
varbinary: You need to specify a fixed length when creating. By default 255, the actual space occupied by data storage is +1 of the actual length of the data.
Bit: You need to specify a fixed length when creating. Default 64
Tinyblob:
Blob: A special binary type for storing binary data with a large amount of data, used to store binary files such as pictures, PDF documents, and more.
Mediumblob:
Longblob

Problem: Floating point and fixed point number difference: A, when the inserted field is higher than their specified precision, will be rounded, but float at this time no error, fixed-point number will have a warning;
b, floating point precision and hardware equipment, system-related, fixed-point number default 10-bit integer;
C, fixed-point precision is higher than floating-point number, all if the data requirements are high, it is recommended to use fixed-point number.
The same point of datetime and timestamp: A, both represent the date and time,
Different points: A, DateTime represents a greater time range, B, timestamp display time according to time zone

Database-Data type

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.