Int(10) or int(11)

I have seen some people use int(10) and int(11) for the int data type on columns. What the max value for an integer value 10 or 11?

Assuming you are referring to MySQL, the maximum(s) are much greater and depend upon the type-of-int.
Check out some resources on the web for details.

I believe 10 is the technical limit of the int column, 11 doesn’t throw an error. There is no difference in storage though.

Try using this SQL:

CREATE TABLE `max_datatypes` (
  `int11` int(11) default NULL,
  `int10` int(10) default NULL

INSERT INTO `max_datatypes` (`int11`, `int10`) VALUES (999999999999, 999999999999);

the 10 vs 11 thing only has to do with display formatting in the mysql client. it has NOTHING to do with the amount of data the column can hold.

Can you explain further what you mean?

i’m not sure how much more detail i can provide. the number after the int is only used by the mysql command line client to format the display output.

and the only thing that affects how big a number that column can hold is the datatype keyword you use: tinyint, smallint, mediumint, int, bigint.

If you have 999,999,999 stored in the database and you retrieve it then if it was in an int(10) field you get back 0999999999 while if it was in an int(11) field you get back 00999999999 and if it was in an int(1) field you get back 999999999. It only affects the leading zeros, not the size of the number that can be stored.

I am completely agree with you Stephen

Got it, thanks!