What is the difference between a tinyint, int, mediumint, ....
| SitePoint Sponsor |



What is the difference between a tinyint, int, mediumint, ....









Essentially how big the numbers can be to the negative and possitive. This also represents the amount of physical space alotted to the database. If you know the numbers will always be tiny then use tinyint as it uses up less physical space than int.![]()
Maelstrom Personal - Apparition Visions
Development - PhP || Mysql || Zend || Devshed
Unix - FreeBSD || FreeBsdForums || Man Pages
They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.
yep, look at the ranges on the manual page that sylow posted. ALWAYS use the smallest type that has enough range for what you need. i always see people using INT for everything!unbelievable. if you don't need negative numbers, make your columns UNSIGNED as well (that would include any AUTO_INCREMENT columns).
- Matt
Dr.BB - Highly optimized to be 2-3x faster than the "Big 3."
"Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR





THANK YOU. I read through the book I have and have never seen 'why' unsigned. Just that it is done sometimes.Originally posted by DR_LaRRY_PEpPeR
yep, look at the ranges on the manual page that sylow posted. ALWAYS use the smallest type that has enough range for what you need. i always see people using INT for everything!unbelievable. if you don't need negative numbers, make your columns UNSIGNED as well (that would include any AUTO_INCREMENT columns).
/me kicks book across room
Of course I could have just checked the manual![]()
Maelstrom Personal - Apparition Visions
Development - PhP || Mysql || Zend || Devshed
Unix - FreeBSD || FreeBsdForums || Man Pages
They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.
Bookmarks