Welcome Guest, Not a member yet? Register   Sign In
Database Design
#2

[eluser]gtech[/eluser]
Here is my two cents.

Apparently numerical IDs are more efficient to search by. But if in another table (lets call it table2) only the county name is associated with the data, then I guess it makes sense to store the country name as text. if you ever require to search in table2 by country then it make sense to use the ID. If you are using more than the country name to associate with table2 (for example population) then maybe using the IDs also makes more sense.

The disadvantages of your approach..
1) if you decide to add more information to the country table, you wont be able to join it with the search results from table2 without having an inefficient search.
2) you are potentially using more table space to store data (even though its negligible).
3) you need to think what might happen if data gets deleted from the countries table, and whether being left with rouge country names matters.
4) if you are searching in table2 by the country name (as opposed to the ID) your search will potentially be less efficient.

Advantages
1) you don't need to use a join to get the data you require.

its up to you to make the call, in my opinion you just need to think whether requirements may change within your webapp.


Messages In This Thread
Database Design - by El Forum - 06-02-2008, 11:01 AM
Database Design - by El Forum - 06-02-2008, 01:34 PM



Theme © iAndrew 2016 - Forum software by © MyBB