Want better links on DZone? We do, too! Login and vote now.
By legendx
via mikebernat.com
Published: Dec 28 2006 / 02:44
One of the biggest mistakes of today's fledgling MySQL programmers is their field type definitions, also known as data type or column type. Many are too quick to set up their tables, flying through the different options without giving it much thought. The time you spend setting up your tables will save you from many headaches later on down the road.



Comments
Lowell Heddings replied ago:
amen to that
bjupton replied ago:
Amen indeed. I like the way you handled these as their similar groups.
Only criticism I would have is on the difference for when to use char vs. varchar, not that it is incorrect, just that it could be tightened up a bit.
For the same length string, varchar will take up more space than a char, so you should use char if this is a set length, like an account number or an SSN. On the other side, if you have a lot of variability in your lengths, then having the extra overhead on each might actually make the table smaller, than if you had every column at the length of the longest string.
Voters For This Link (22)
Voters Against This Link (1)