stevenhu — 2013-05-08T17:17:04-04:00 — #1
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?
r937 — 2013-05-08T17:35:26-04:00 — #2
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)
stevenhu — 2013-05-08T17:37:16-04:00 — #3
felgall — 2013-05-08T18:15:03-04:00 — #4
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.
stevenhu — 2013-05-08T18:16:41-04:00 — #5
Thank you, Stephen; that's helpful! I'll make the change.