TINYINT can be set to length of 4, but that doesn’t mean the max value is 9999. A tiny int will always have the same range no matter what size you specify since that isn’t what it is for with integers. It is the display width for the command line output.

This is what I was able to find in the MySQL manual:

The display width does not constrain the range of values that can be stored in the column, nor the number of digits that are displayed for values having a width exceeding that specified for the column.

Reading the manual for things like this isn’t something people normally do. I had no idea about this until recently and I’ve been using MySQL for a long time.

Reference Chart for Max Signed Integers

TINYINT 127
SMALLINT 32767
MEDIUMINT 8388607
INT 2147483647
BIGINT 9223372036854775807

However, CHAR and VARCHAR work as expected with these limits.

I use webfaction to host a lot of my django projects. It has an easy setup that will get you developing quickly and a great community of talented programmers. There is also a quick setup for rails, wordpress, and a lot more.

Related posts:

  1. Setting up Apache2, mod_python, MySQL, and Django on Debian Lenny or Ubuntu Hardy Heron  Both Debian and Ubuntu make it really simple to get a server up and running. I was trying a few...
  2. Conditions on Count or Sum in MySQL  When selecting count, sum, or some other aggregate function, the value isn’t determined until after the WHERE clause so a...
  3. Tips for MySQL to PostgreSQL Switch  If you’ve decided to move a few tables from MySQL to PostgreSQL, these few tips might help. I won’t get...