MySQL supports data types

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

The number of value type;



MySQL includes strict data types (INTEGER, SAMLLINT, DECIMAL, NUMERIC), and near like data types (FLOAT, REAL, DOUBLE), extended after the addition of TINYINT, MEDIUMINT and BIGINT these three kinds of different length of plastic, and increase the BIT type, used to store data.


In the integer types, according to the value the scope and stored in different ways, can be divided into tinyint, smallint, mediumint, these 5 types int and bigint. For shaping data, MySQL support in the type name is behind the small brackets specifies the display width, such as int (5) expressed as the number of value width of less than 5 bits in the digital front fill width, if the specified width is the default for int does not show(11).
Zerofill is' 0 'filled with meaning, in the space of digits not using character' 0 'fill.


Date and time types



Mysql has a variety of data types can be used to represent the date and time.
The main difference between these data types are as follows:
(1)If you want to date, usually expressed in DATE,
(2)If you want to indicate the date when the minutes and seconds, usually expressed in DATETIME,
(3)If only used to indicate when the minutes and seconds, usually expressed in TIME,
(4)If you need to approach the insert or update the date for the current system time, usually use TIMESTAMP to represent.
(5)If only the year, can use YEAR to represent.


Different type of date zero value representation is shown as follows:
Data type Zero value representation;
DATETIME 0000-00-00 00:00:00
TIME 00:00:00
DATE 0000-00-00
TIMESTAMP 00000000000000
YEAR 0000


String types



CHAR and VARCHAR are like, to the shorter string stored in MySQL. The main difference between the two lies in the storage of different: the length of the CHAR column is fixed to the statement create table length, length can be from any value 0~255; and VARCHAR, in the value column; for variable length string, the length can be specified as 0~255 value. When searching, CHAR removed the empty tail;, VARCHAR kept the empty.


BINARY and VAEBINARY type of like on CHAR and VAECHAR, the difference is they contain binary string. When saving BINARYvalue value finally, by filling the "0x00" in order to achieve the defined length of the specified field.


ENUM is an enumeration type, its value range need to enumerate through when creating the table displays the specified. But ENUM only allows selection of single from value value collection;, but not one to take multiplevalue.
The SET type can permit from the value select any 1 or more elements are combined. If contains repeated elements in the collection, so we will only take a.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Simon at December 12, 2013 - 8:53 PM