02-23-2008, 04:59 AM
|
#5 (permalink)
|
|
The Acquainted
Join Date: Nov 2007
Posts: 154
Thanks: 31
|
Good call on the ALTER statement to create a UNIQUE index. In cases like this where you want to avoid users having the same username, the easiest way to implement it (and have the benefits of using an index) is with UNIQUE.
Quote:
Originally Posted by Aaron
Thanks for your help. I didn't think that more than 4 people would have an account on this, so I just made it a smallint.
|
Well, that will certainly hold 4 accounts.
TINYINT (unsigned) is up to 255.
SMALLINT (unsigned) will run up to 65,535.
INT (unsigned) is up to 4,294,967,295 (yes, that's trillion).
In your case, especially for test tables or small user groups, TINYINT(2) UNSIGNED (to 99) will usually suffice. Just one byte per value.
MySQL Manual : Data Types | Numeric types
__________________
I reject your reality, and substitute my own.
|
|
|
|