Is there a difference in using INT(1) vs TINYINT(1) in MySQL?

前端 未结 3 1068
借酒劲吻你
借酒劲吻你 2020-12-13 03:42

I\'m under the assumption that INT(1) is the exact same thing as TINYINT(1) but I really have no idea. Whenever I\'ve had values that can only be a single integer (e.g. a va

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-13 04:17

    Here you'll understand it in a better way!

    tinyint: 1 byte, -128 to +127 / 0 to 255 (unsigned)
    smallint: 2 bytes, -32,768 to +32,767 / 0 to 65,535 (unsigned)
    mediumint: 3 bytes, -8,388,608 to 8,388,607 / 0 to 16,777,215 (unsigned)
    int/integer: 4 bytes, -2,147,483,648 to +2,147,483,647 / 0 to 4,294,967,295 (unsigned)
    bigint: 8 bytes, -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 / 0 to 18,446,744,073,709,551,615 (unsigned)
    

提交回复
热议问题