MySQL Data Types

MySQL Data Types

MySQL Data Types are very important to know beacuse they specify what kind of information you store in your columns and they can save a lot of space of your database.We should use only the type and size of field we really need to use

MySQL have many different types of data types like numeric, character, large strings or binary data, date and time and spatial.

Numeric Data Types

  • INT: it requires 4 bytes of storage.Signed values ranges from -2147483648 to 2147483647 and for Unsigned values ranges from 0 to 4294967295.
  • BIGINT: it requires 8 bytes of storage.Signed values ranges from -9223372036854775808 to 9223372036854775807 and for Unsigned values ranges from 0 to 18446744073709551615.
  • MEDIUMINT: it requires 3 bytes of storage.Signed values ranges from -8388608 to 8388607 and Unsigned values ranges from 0 to 16777215.
  • SMALLINT: it requires 2 bytes of storage.Signed values ranges from -32768 to 32767 and Unsigned values ranges from 0 to 65535.
  • TINYINT: it requires 1 bytes of storage.Signed values ranges from -128 to 127 and Unsigned values ranges from 0 to 255
  • DECIMAL(M,D): it bytes vary.Fiexd Precision Numbers where M is the maximum numbers of total digits and D is the number of decimals. M can be range from 1 to 65 and D ranges from 0 to 30.
  • DOUBLE(M,D) it requires 8 bytes. Double-precision floating-point numbers from -1.7976x10308 to 1.7976x10308.
  • FLOAT(M,D): it requires 4 bytes.Single-precision floating-point numbers from -3.4028x1038to 3.4028x1038

Click Here To Read MySQL Data Types Tutorial

要查看或添加评论,请登录

Mudit Jain的更多文章

社区洞察

其他会员也浏览了