-----Original Message----- From: Jigal van Hemert [mailto:[EMAIL PROTECTED] Subject: Re: Phone Number Storage
>From: "Sujay Koduri" >> I guess anywhere we have 3 levels of hierarchies for a phone number. >> (Country code, Area code and the actual number). > >That's a pretty wild guess IMHO. You have to be absolutely sure that this is true for each and every >country in the world. Furthermore, various telecom providers have short phone numbers for their own >services that are only valid for their clients. If your application is to store these numbers too (e.g. a >billing application) then you will have phone numbers without country and area code! I've spent much of the last 6 months dealing with Australian & international numbers, and the true situation is considerably more complex than Sujay suggests. For example, standard Australian numbers are 8 digits, but 10 with STD (inter-state). Free call ranges are 10 digits starting with "18", local call are 6 or 10 digits starting with "13". Mobiles start with "04", domestic satellite phones start with "14" and Optus have 15 digit number ranges starting with "127". The usual international prefix is "0011", and customers can specify carrier override with 4 digits prepended to the destination number. >> The advantage of seperating them into different columns(Either an >> integer or >> a string) is that he can group different phone numbers based on area >> code or >> country code. > >Phone numbers cannot be considered to be numbers IMHO. The customer might want to store the "name" version >of a phone number (in some countries you can get phone 'numbers' in certain fictive "area codes" where the >"actual number" consists of letters (e.g. 0800-mysql). If these 'numbers' are to be stored too an integer >type field will not suffice. > >If you need to group phone numbers it will only be based on country code, country code plus area code, or >country code plus area code plus a part of the actual number. So you need to group by phone number starts >with. This can easily be done with a string type and an index. > >Using a clever and consistent format to seperate the various parts of the phone number (whole parts with >leading zero's!) combined with knowledge on how to build the number to dial (drop the leading zero or not, >etc.) is all you need to make an application that works in more than one country. Separators tend to be standardised to an extent - usually space or hyphen, and voice switches ignore them, but assuming that they will only appear in specific places is unrealistic. Your comment about treating numbers as strings is spot-on (and initially may be counter-intuitive). Separating into area code plus number doesn't work here in Oz - for example, "08" is Western Australia, and also South Australia. And literally millions of numbers don't have an area code at all - mobiles and everything starting with "1". Paul Wilson iiNet Ltd 6/263 Adelaide Tce, Perth, WA6000 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]