Skip to main content

Field Type

MySQL database is designed for professional developers. If you are unfamiliar with database data types, it is recommended to use the Data Model to define the data source structure.

Numeric Type

Data TypeValue RangeDescriptionApplicable Scenarios
TINYINT-128 to 127 (signed)
0 to 255 (unsigned)
Smallest integer typeStatus values, age, small numerical values
SMALLINT-32768 to 32767 (signed)
0 to 65535 (unsigned)
Small integer typeCounters; small-range numerical values
MEDIUMINT-8388608 to 8388607 (signed)
0 to 16777215 (unsigned)
Medium integer typeMedium-range counting, IDs
INT-2147483648 to 2147483647 (signed)
0 to 4294967295 (unsigned)
Standard integer typePrimary key IDs, quantities, counts
BIGINT-9223372036854775808 to 9223372036854775807 (signed)Large integer typeLarge numerical values, timestamps, large IDs
DECIMALDepends on precision and scale settingsExact decimal typeMonetary amounts, precise calculations
FLOATApproximately -3.4E+38 to 3.4E+38Single-precision floating-point numberScientific computing, approximate values
DOUBLEApproximately -1.8E+308 to 1.8E+308Double-precision floating-point numberHigh-precision scientific computing
REALSame as DOUBLESynonym for DOUBLEUsed for compatibility
BIT0 to 2^n-1Bit-field typeFlags, bitmasks
SERIAL1 to 9223372036854775807Auto-incrementing large integer (BIGINT UNSIGNED AUTO_INCREMENT)Auto-increment primary key
BOOLEANTRUE (1) or FALSE (0)Boolean type (alias for TINYINT(1))Switch states, yes/no decisions

Date and Time Types

Data TypeValue RangeFormatApplicable Scenarios
DATE1000-01-01 to 9999-12-31YYYY-MM-DDBirthdays, date records
DATETIME1000-01-01 00:00:00 to 9999-12-31 23:59:59YYYY-MM-DD HH:MM:SSCreation time, update time
TIMESTAMP1970-01-01 00:00:01 to 2038-01-19 03:14:07YYYY-MM-DD HH:MM:SSTimestamp, automatic update time
TIME-838:59:59 to 838:59:59HH:MM:SSTime periods, duration
YEAR1901 to 2155YYYYYear records

Text Type

Data TypeMaximum LengthDescriptionApplicable Scenarios
CHAR255 charactersFixed-length stringFixed-format encoding, status codes
VARCHAR65535 charactersVariable-length stringUsernames, titles, descriptions
TINYTEXT255 charactersShort textShort descriptions, tags
TEXT65535 charactersText typeArticle content, detailed descriptions
MEDIUMTEXT16777215 charactersMedium-length textLong articles, rich text content
LONGTEXT4294967295 charactersLong textLarge documents, HTML content
BINARY255 bytesFixed-length binary dataHash values, fixed-length encoding
VARBINARY65535 bytesVariable-length binary dataFile data, encrypted information
TINYBLOB255 bytesSmall binary objectSmall icons, thumbnails
MEDIUMBLOB16777215 bytesMedium binary objectImages, audio files
BLOB65535 bytesBinary Large ObjectFile, image data
LONGBLOB4294967295 bytesLong binary objectLarge files, video data
ENUM65535 distinct valuesEnumeration type, select one from a predefined list of valuesStatus values, category options
SET64 distinct membersCollection type, select multiple from a predefined list of valuesPermission settings, multi-select tags
JSONMaximum document size 1GBJSON format dataConfiguration information, structured data

Spatial Data Types

Data TypeDescriptionApplicable Scenarios
GEOMETRYGeneral geometry typeAny geometric shape
POINTPoint typeLocation markers, coordinate points
LINESTRINGLine String TypePaths, trajectories
POLYGONPolygon typeArea boundaries, geofences
MULTIPOINTMultipoint typeMultiple location points
MULTILINESTRINGMulti Line String TypeMultiple paths
MULTIPOLYGONMultiPolygon typeMultiple regions
GEOMETRYCOLLECTIONGeometry collection typeCollection of mixed geometric objects