Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
So, I wanted to ask the people who have had quite a bit of experience in making databases. I was thinking of using a tree view control to help separate data into either tables through a connection string or using filters.

The data I am presented with is multiple state and county information. I was thinking about making the database be the state and then make each individual county be a table for that state, essentially I would have 50 databases.

I could also do 50 databases and 1 large table and use a filter in treeview to only call forth the county I pick from the treeview. I would just use a sql distinct statement and pass the values of the county into treeview.

essentially it is the same thing, but which way is better and why?

What I have tried:

As explained, I am only doing this one of two ways I just wanted to know which of the 2 ways are better.
Posted
Updated 24-May-17 1:14am

Quote:
I was thinking about making the database be the state and then make each individual county be a table for that state, essentially I would have 50 databases.


As to me - sounds like wrong approach. I'd suggest to read about database normalization. See:
Database normalization - Wikipedia[^]
1NF, 2NF, 3NF and BCNF in Database Normalization | DBMS Tutorial | Studytonight[^]
DBMS Normalization[^]

At this moment you have to move your focus on database structure and forget about components to display that data. If you would like to store the same information about each coutry and each state you have to create one table for countries and related (1 to many relationship) states table. Please, see:
11 important database designing rules which I follow[^]
Ten Common Database Design Mistakes - Simple Talk[^]
Relational Database Design[^]
Database design basics - Access[^]
 
Share this answer
 
The third way is the best....have one database with one table for state and one table for county.

SQL
State
-----
ID, Name

County
------
ID, StateID, Name


You'll thank us later :)
 
Share this answer
 
Comments
Member 11856456 24-May-17 16:26pm    
I can kind of see what you are doing, this configuration falls under sql normalization. The originalgriff and a few others have suggested looking into it, which I have. I do not understand it as much, I know there are 4 levels to it. Just didnt know that my question would follow the same guidelines. One of my other questions dealt with images and it was suggested to do the same thing, just make a table of the images and that all images should be n one column. Anyways, I will look more into sql normaization. Thanks both of you for the replies.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900