<p>What is the "<em>best</em>" way to store international addresses in a database? Answer in the form of a schema and an explanation of the reasons why you chose to normalize (or not) the way you did. Also explain why you chose the type and length of each field.</p>

<p><strong>Note: You decide what fields you think are necessary.</strong></p>

[{'answer_id': 24485, 'author': 'Abhinav', 'author_id': 2617, 'author_profile': 'https://Stackoverflow.com/users/2617', 'pm_score': -1, 'selected': False, 'text': '<p>You need to provide a bit more details about how you are planning to use the data. For example, fields like City, State, Country can either be text in the single table, or be codes which are linked to a separate table with a Foreign Key.</p>\n\n<p>Simplest would be</p>\n\n<p>Address_Line_01 (Required, Non blank)\nAddress_Line_02\nAddress_Line_03\nLandmark\nCity (Required)\nPin (Required)\nProvince_District\nState (Required)\nCountry (Required)</p>\n\n<p>All the above can be Text/Unicode with appropriate field lengths.</p>\n\n<p>Phone Numbers as applicable.</p>\n'}, {'answer_id': 24501, 'author': 'DrPizza', 'author_id': 2131, 'author_profile': 'https://Stackoverflow.com/users/2131', 'pm_score': 6, 'selected': True, 'text': "<p>Plain freeform text.</p>\n\n<p>Validating all the world's post/zip codes is too hard; a fixed list of countries is too politically sensitive; mandatory state/region/other administrative subdivision is just plain inappropriate (all too often I'm asked which county I live in--when I don't, because Greater London is not a county at all).</p>\n\n<p>More to the point, it's simply unnecessary. Your application is highly unlikely to be modelling addresses in any serious way. If you want a postal address, ask for the postal address. Most people aren't so stupid as to put in something other than a postal address, and if they do, they can kiss their newly purchased item bye-bye.</p>\n\n<p>The exception to this is if you're doing something that's naturally constrained to one country anyway.  In this situation, you should ask for, say, the { postcode, house number } pair, which is enough to identify a postal address.  I imagine you could achieve similar things with the extended zip code in the US.</p>\n"}, {'answer_id': 148306, 'author': 'The Brawny Man', 'author_id': 11936, 'author_profile': 'https://Stackoverflow.com/users/11936', 'pm_score': 3, 'selected': False, 'text': "<p>In the past I've modeled forms that needed to be international after the ups/fedex shipping address forms on their websites (I figured if they don't know how to handle an international order we are all hosed).  The fields they use can be used as reference for setting up your schema.</p>\n"}, {'answer_id': 148325, 'author': 'MSalters', 'author_id': 15416, 'author_profile': 'https://Stackoverflow.com/users/15416', 'pm_score': 3, 'selected': False, 'text': "<p>In general, you need to understand why you want an address. Is it for shipping/mailing? Then there is really only one requirement, have the country separate. The other lines are freeform, to be filled in by the user. The reason for this is the common forwarding strategy for mail : any incoming mail for a foreign country is forwarded without looking at the other address lines. Hence, the detailed information is parsed only by the mail sorter located in the country itself. Like the receiver, they'll be familiar with national conventions.</p>\n\n<p>(UPS may bunch together some small European countries, e.. all the Low Countries are probably served from Belgium - the idea still holds.)</p>\n"}, {'answer_id': 1446404, 'author': 'Cem Kalyoncu', 'author_id': 173347, 'author_profile': 'https://Stackoverflow.com/users/173347', 'pm_score': 2, 'selected': False, 'text': '<p>I think adding country/city and address text will be fine. country and city should be separate for reporting. Managers <strong>always</strong> ask for these kind of reports which you do not expect and I dont prefer running a LIKE query through a large database.</p>\n'}, {'answer_id': 5930941, 'author': 'Matt', 'author_id': 744311, 'author_profile': 'https://Stackoverflow.com/users/744311', 'pm_score': 2, 'selected': False, 'text': "<p>Not to give Facebook undue respect. However, the overall structure of the database seems to be overlooked in many web applications launching every day.  Obviously I don't think there is a perfect solution that covers all the potential variables with address structure without some hard work.  That said, combined with autocomplete Facebook manages to take location input data and eliminate a majority of their redundant entries.  They do this by organizing their database well enough to provide autocomplete information in a low cost, low error way to the client in real time allowing them to more or less choose the correct location from an existing list.</p>\n\n<p>I think the best solution is to access a third party database which contains your desired geographic scope and use it to initially seed your user location information.  This will allow you to avoid doing the groudwork of creating your own.  With any luck you can reduce the load on your server by allowing your new users to receive the correct autocomplete information directly off your third party supplier.  Eventually you will be able to fill most autocomplete for location information such as city, country, etc. from information contained in your own database from user input data.</p>\n"}]
['https://Stackoverflow.com/questions/24481', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2627/']