-3

What is difference between INT(1) and INT(11) and 99999 value which one store?

ANILGAGAN
  • 5
  • 4
  • 3
    Possible duplicate of [What does INT(1) stand for in MySQL?](https://stackoverflow.com/questions/11563830/what-does-int1-stand-for-in-mysql) – dfundako Jun 05 '18 at 17:34
  • Possible duplicate of [What is the size of column of int(11) in mysql in bytes?](https://stackoverflow.com/questions/5634104/what-is-the-size-of-column-of-int11-in-mysql-in-bytes) – Shawn Jun 05 '18 at 17:36

1 Answers1

-3

A signed int can store up to 4 bytes which is a number range between -2,147,483,648 to 2,147,483,647.

An unsigned int can store numbers from 0 to 4,294,967,295.

int(1) and int(11) are both signed ints and will therefore store numbers that range from -2,147,483,648 to 2,147,483,647.

The only difference is that int(1) will only display 1 number and int(11) will display 11 numbers.

99999 in an int(1) will store 99999 but will only display 9.
99999 in an int(11) will store 99999 and will display 99999.

Bryner
  • 397
  • 3
  • 18
  • 2
    I don't use MySQL, but is this accurate? It sounds like the number in the brackets has nothing to do with storage. – dfundako Jun 05 '18 at 17:37
  • You could be right about storage. I believe if you have a number with 12 digits in an int(11), it will store all 12 digits, but only 11 will be displayed no matter what. I haven't played with MySQL in a while so my memory is foggy. – Bryner Jun 05 '18 at 17:40
  • 1
    No, this is completely wrong. An int stores the same range of values regardless of the "length". That number is just used for display purposes under certain circumstances, most notably when zerofill is involved. – Uueerdo Jun 05 '18 at 17:40
  • 1
    @Bryner Flagging as incorrect. Please remove this answer. – dfundako Jun 05 '18 at 17:52
  • Well, it still says "The only difference is that int(1) will only display 1 number and int(11) will display 11 numbers." so no. – Strawberry Jun 05 '18 at 20:04
  • I am not satisfied this line (The only difference is that int(1) will only display 1 number and int(11) will display 11 numbers.) – ANILGAGAN Jun 06 '18 at 16:26