Database Structure - Best method?
Posted: Fri Mar 19, 2004 8:06 am
Hiya guys,
I'm trying to come up with a workable database structure / user interface, and I'm really interested to see what you think is the best solution.
Lets say that I have a table storing a list of items, lets say basic components. This table simply stores an ID and a name for each item.
Then, a specific unit it created by selecting these components from a group of tick boxes on a page. What would be the best way to structure the database that holds these units, given that the number of components can vary from just a few to, well, how ever many components there are.
My initial thought was to just give it an ID, and a name, and then a single field with a comma separated list of the components and just save one row per unit. The problem then is display ... how do I then split that list and attach values to the tick boxes, and vice versa?
Alternatley, I add a row per component and tag them with a unit number.
The thing is, I also want to create a page where a unit can be loaded, and then show a list of used components all ticked, and list of all components all unticked, and allow the default components to be changed. Again I was thinking that the easiest way to store this data is in two columns of comma separated values, one components removed, and one components added. Of course, I would also have to store the standard unit profile in there also.
What would be the best db layout for this kind of thing? And how would I go about attaching the values to the tick boxes of the forms.
Any help would be great, thanks.
I'm trying to come up with a workable database structure / user interface, and I'm really interested to see what you think is the best solution.
Lets say that I have a table storing a list of items, lets say basic components. This table simply stores an ID and a name for each item.
Then, a specific unit it created by selecting these components from a group of tick boxes on a page. What would be the best way to structure the database that holds these units, given that the number of components can vary from just a few to, well, how ever many components there are.
My initial thought was to just give it an ID, and a name, and then a single field with a comma separated list of the components and just save one row per unit. The problem then is display ... how do I then split that list and attach values to the tick boxes, and vice versa?
Alternatley, I add a row per component and tag them with a unit number.
The thing is, I also want to create a page where a unit can be loaded, and then show a list of used components all ticked, and list of all components all unticked, and allow the default components to be changed. Again I was thinking that the easiest way to store this data is in two columns of comma separated values, one components removed, and one components added. Of course, I would also have to store the standard unit profile in there also.
What would be the best db layout for this kind of thing? And how would I go about attaching the values to the tick boxes of the forms.
Any help would be great, thanks.