vineld Posted August 10, 2009 Share Posted August 10, 2009 How do you usually solve the question of organizing geographical and political structures in a database? For example states, counties, cities etc. In many cases people put everything in one single table, using the parent-child model, and in other cases they are stored in separate tables. I have used both alternatives myself depending on the situation given but I would like to hear what you all have to say on pros and cons of the two solutions. Quote Link to comment https://forums.phpfreaks.com/topic/169535-geographical-political-structures/ Share on other sites More sharing options...
abazoskib Posted August 10, 2009 Share Posted August 10, 2009 if i was going to make a geographical db i would definitely use separate tables for states, counties, and cities. many many reasons but organization alone is enough for me to do that. i couldnt even imagine one table for everything. your statement though does not make sense, as the parent/child model does not involve one table for everything. Quote Link to comment https://forums.phpfreaks.com/topic/169535-geographical-political-structures/#findComment-894583 Share on other sites More sharing options...
vineld Posted August 10, 2009 Author Share Posted August 10, 2009 Most of the time I use separate tables as well, especially when there is some information that is specific to one of the structures. However, it is possible to implement the parent-child model with just one table. Quote Link to comment https://forums.phpfreaks.com/topic/169535-geographical-political-structures/#findComment-894590 Share on other sites More sharing options...
Daniel0 Posted August 10, 2009 Share Posted August 10, 2009 as the parent/child model does not involve one table for everything. Any 1:1 or 1:n relationship will need two tables unless the relationship is self-referential. Quote Link to comment https://forums.phpfreaks.com/topic/169535-geographical-political-structures/#findComment-894598 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.