Ispirer Ispirer
 


Ispirer Home Page Ispirer SQLWays Product Page - Migration to MySQL Request SQLWays

MySQL Data Types

Versions: MySQL 5.x, 4.x and 3.23

Data Type Parameters and Range
Character Data Types
CHAR(n) - Fixed-length character data 0 ⇐ n ⇐ 255, default is 1
NCHAR(n) - Fixed-length character data in UTF8 0 ⇐ n ⇐ 255, default is 1
VARCHAR(n) - Variable-length character data 1 ⇐ n ⇐ 65535/charsize, n is mandatory
NVARCHAR(n) - Variable-length character data in UTF8 1 ⇐ n ⇐ 21845, n is mandatory
TINYTEXT - Variable-length character data 255 bytes
TEXT(n) - Variable-length character data 65555 bytes
MEDIUMTEXT - Variable-length character data 16,777,215 (224 – 1) bytes
LONGTEXT - Variable-length character data 4G (232 – 1) bytes
Integer Data Types
BIGINT - 64-bit integer data Signed: -263 to 263-1, Unsigned: 0 to 264-1
INT, INTEGER - 32-bit integer data Signed: -231 to 231-1 (2G), Unsigned: 0 to 232-1 (4G)
MEDIUMINT - 24-bit integer data Signed: -215 to 215-1 (8,388,607), Unsigned: 0 to 216-1 (16,777,215)
SMALLINT - 16-bit integer data Signed: -32768 to 32767, Unsigned: 0 to 65535
TINYINT - 8-bit integer data Signed: -128 to 127, Unsigned: 0 to 255
Decimal Data Types
DECIMAL(p,s), NUMERIC(p,s) - Fixed-point numeric data 1 ⇐ p ⇐ 65, default is 10; 0 ⇐ s ⇐ 30, default is 0
Floating-Point Data Types
FLOAT(p,s) - Floating-point numeric data -3.402E+38 to -1.1754E-38, 0, and 1.175E-38 to 3.402E+38
REAL(p,s) - Floating-point numeric data Synonym for FLOAT or DOUBLE depending on REAL_AS_FLOAT option
DOUBLE(p,s) - Floating-point numeric data -1.797E+308 to -2.2254E-308, 0, and 2.225E-308 to 1.797E+308
Date and Time Data Types
DATE - Date data (year, month and day) January 01, 1000 to December 31, 9999
TIME - Time data (hours, minutes and seconds) -838:59:59 to 838:59:59
DATETIME - Date and time data (year, month, day,
hours, minutes and seconds)
January 01, 1000 00:00:00 to December 31, 9999 23:59:59
TIMESTAMP - Auto-updated date and time data (year, month, day,
hours, minutes and seconds)
January 01, 1970 00:00:01 to January 01, 2038 23:59:59
YEAR - Year data 4 digit format: 1901 to 2155 and 0; 2 digit format: 70 to 69 (1970 to 2069)
Binary Data Types
BINARY(n) - Fixed-length binary data 0 ⇐ n ⇐ 255, default is 1
VARBINARY(n) - Variable-length binary data 1 ⇐ n ⇐ 65535, n is mandatory
TINYBLOB - Variable-length binary data 255 bytes
BLOB(n) - Variable-length binary data 65555 bytes
MEDIUMBLOB - Variable-length binary data 16,777,215 (224 – 1) bytes
LONGBLOB - Variable-length binary data 4G (232 – 1) bytes
Others Data Types
BOOL, BOOLEAN - Boolean data -128 to 127 and NULL
BIT(n) - Bit array 1 ⇐ n ⇐ 64, default is 1
ENUM - Enumeration data 65535 distinct values
SET - Set data 64 values

Data Types in Other Databases


Ispirer Home Page Ispirer SQLWays Product Page - Migration to MySQL Request SQLWays

sqlways/mysql/data-types.txt · Last modified: March 20, 2013, 03:56:23 AM (external edit)
 
© 1999-2018, Ispirer Systems Ltd.
All Rights Reserved.  Privacy Statement