I'm setting up a MySQL table and I imagine an URL and email data type would be VARCHAR 50, but I'm not sure about a phone number. Because it's made of numbers, TINYINT? There won't be any arithmetic performed on the numbers, so TINYTEXT would be fine?
i love the premise, and i agree with it -- when was the last time you were asked to find the AVG(phonenumber) or SUM(phonenumber)?
but the conclusion is false... since there won't be any arithmetic performed on the numbers, use VARCHAR
(besides, TINYINT isn't big enough)
varchar 50 is a bit small for urls or email addresses - a domain name can be up to 63 characters long by itself and the part of an email address before the @ can be up to 255 characters long (but is unlikely to be anywhere near that big) so a varchar 255 is probably the most appropriate value (since it doesn't take any more space if the values all turn out to be less than 50 and greater than 255 is possible but so unlikely that it isn't worth catering for.
Thank you, Stephen; that's helpful! I'll make the change.
This topic is now closed. New replies are no longer allowed.