What is the difference between tinyint, smallint, mediumint, bigint and int in MySQL?

前端 未结 6 2142
误落风尘
误落风尘 2020-11-29 14:43

What is the difference between tinyint, smallint, mediumint, bigint and int in MySQL?

In what cases should these be used?

6条回答
  •  旧时难觅i
    2020-11-29 14:50

    Those seem to be MySQL data types.

    According to the documentation they take:

    1. tinyint = 1 byte
    2. smallint = 2 bytes
    3. mediumint = 3 bytes
    4. int = 4 bytes
    5. bigint = 8 bytes

    And, naturally, accept increasingly larger ranges of numbers.

提交回复
热议问题