Storing information for drop-down menus

Posted by Mark on Stack Overflow See other posts from Stack Overflow or by Mark
Published on 2010-04-06T05:36:16Z Indexed on 2010/04/06 5:43 UTC
Read the original article Hit count: 155

Filed under:

Suppose you're building an HTML form and you want to have 2 or more drop-down menus, where after picking an option from the first, the 2nd menu is populated, and so forth. For example, choosing a country would bring up a list of provinces for that country, which would in turn list the cities.

How would you store that sort of information in a database? Would you have a table Countries(id, name), Provinces(id, country_id, name), Cities(id, province_id, name) or would you have just one big denormalized table Entries(country, province, city)? (Why?)

© Stack Overflow or respective owner

Related posts about database-design