Data Type

Character

  • CHAR(size) [255, Default 1], VARCHAR(size) [65,535]

  • TINYBLOB [255], BLOB(size) [65,535], MEDIUMBLOB [16,777,215], LONGBLOB [4,294,967,295]

    • BLOBs (Binary Large Objects). [Unit: Byte]

  • TINYTEXT [255], TEXT(size) [65,535], MEDIUMTEXT [16,777,215], LONGTEXT [4,294,967,295]

  • BINARY(size) [CHAR(), Byte, Default 1], VARBINARY(size) [VARCHAR()]

  • ENUM(val1, val2, val3, ...), SET(val1, val2, val3, ...)

Number

  • BIT(size) [64, Default 1], BOOL [Zero=false, nonzero=true], BOOLEAN [BOOL]

  • TINYINT(size) [1], SMALLINT(size) [2], MEDIUMINT(size) [3], INT(size) [4], INTEGER(size) [INT(size), 4], BIGINT(size) [8]

    • The size parameter specifies the maximum display width (which is 255)

    • Memory Unit: Byte

  • FLOAT(p)

    • FLOAT(p): p is 0 to 24 for float, p is 25 to 53 for double

    • d = number of digits after the decimal point

  • DOUBLE(size, d), DOUBLE PRECISION(size, d)

    • size = total number of digits (including digit before and after the decimal point)

    • d = number of digits after the decimal point

    • Memory = 64 Bit

  • DECIMAL(size, d) [max_size=65, max_d=30 (default d=0)], DEC(size, d) [DECIMAL(size, d)]

Date

  • DATE [YYYY-MM-DD] ['1000-01-01' to '9999-12-31']

  • DATETIME(fsp) [YYYY-MM-DD hh:mm:ss] ['1000-01-01 00:00:00' to '9999-12-31 23:59:59']

    • fsp (fractional seconds precision) [fsp = 0 to 6] [DATETIME(3) means milliseconds]

  • TIMESTAMP(fsp) [YYYY-MM-DD hh:mm:ss] ['1970-01-01 00:00:01' UTC to '2038-01-09 03:14:07']

  • TIME(fsp) [hh:mm:ss] ['-838:59:59' to '838:59:59']

  • YEAR [YYYY] [0000, 1901 to 2155]

Last updated

Was this helpful?