Promotic
WikipediaLinkedInYoutubeTwitterFacebook

Data types in MySQL

Data type Length Description
TINYINT 1 byte Range from -128 to +127 (unsigned: from 0 to 255)
SMALLINT 2 bytes Range from -32 768 to +32 767 (unsigned: from 0 to 65 535)
MEDIUMINT 3 bytes Range from -8 388 608 to +8 388 607 (unsigned: from 0 to 16 777 215)
INT,INTEGER 4 bytes Range from -2 147 483 648 to +2 147 483 647 (unsigned: from 0 to 4 294 967 295)
BIGINT 8 bytes Range from -9 223 372 036 854 775 808 to +9 223 372 036 854 775 807 (unsigned: from 0 to 18 446 744 073 709 551 615)
BIT, BOOL 1 byte synonym for TINYINT(1)
FLOAT   Range from -3.402823466E+38 to +3.402823466E+38
DOUBLE   Range from -1.7976931348623157E+308 to +1.7976931348623157E+308
DOUBLE PRECISION, REAL   synonym for DOUBLE type
DECIMAL(m,d), DEC(m,d), NUMERIC(m,d   the range sets the parameters "m" and "d", the maximum range is similar to DOUBLE type
DATE '0000-00-00' the date in format "year-month-day" meaning "RRRR-MM-DD". Range from 1000-01-01 to 9999-12-31
DATETIME '0000-00-00 00:00:00' date and time. Range from 1000-01-01 00:00:00 to 9999-12-31 23:59:59 (format = "RRRR-MM-DD HH:MM:SS")
TIMESTAMP(n) '0000-00-00 00:00:00'
- date and time in the range from 1970-01-01 00:00:00 to 2037-01-01 00:00:00 (all 14 digits are always stored !)
- the display format can be set by "m" parameter with the value of 14 (or missing), 12, 10, 8, 6, 4, or 2
- "RRRRMMDDHHMMSS", "RRMMDDHHMMSS", "RRMMDDHHMM", "RRRRMMDD", "RRMMDD", "YYMM", "YY"
- if no data is written into such cell then the MySQL will add the current time of modification of the corresponding row
TIME '00:00:00' time range is from "-838:59:59" to "838:59:59" (format "HH:MM:SS")
YEAR(n) 0000 YEAR(4) = range from 1901 to 2155, (format "RRRR"), YEAR(2) = range from 1970 to 2069
CHAR(m)  
- the string length "m" can be in the range from 0 to 255
- if the entered string is shorter than defined, then the missing characters are filled automatically with spaces (the length is fixed)
- CHAR (without "m") is considered to be CHAR(1)
VARCHAR(m)  
- the string length "m" can be in the range from 0 to 255
- if the entered string is shorter than defined, then the missing characters are not filled (the length is flexible), but the information about its length is also stored
TINYBLOB, TINYTEXT   String length is max. 255 characters
BLOB, TEXT   String length is max. 65 535 characters
MEDIUMBLOB, MEDIUMTEXT   String length is max. 16 777 215 characters
LONGBLOB, LONGTEXT   String length is max. 4 294 967 295 characters
ENUM('item1','item2',...)  
- array of defined strings (items) of the max. number of 65 535
- the table cell may contain only a single item of the defined set
- instead of using the 'item' name, the item order can also be used: 1 (instead of 'item1'), 2 (instead of 'item2')...
SET('item1','item2',...)  
- array of defined strings (items) with the max. number of 64
- the table cell may contain multiple defined items
 
See http://dev.mysql.com/doc/refman/5.6/en/data-types.html, http://www.junext.net/mysql/.

History:
Pm8.02.00: Created
PROMOTIC 9.0.13 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice