469,592 Members | 1,933 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,592 developers. It's quick & easy.

Best Practices for Storing Set Combinations

I hope this is the correct newsgroup for this query (if not please
give me a pointer to where is best):

I understand the theory of normalisation etc and am trying to follow
best practices in the design of the database for a new project, but I
am unsure as to the best practice when one wants to store data
relating to combinations of arbitrary numbers of sets of data. For
example, take the following two groups of sets, each containing
elements of data which can be combined together in different ways,
each combination requiring a field of information to be related to it:
Group 1
-------
Set 1: a, b and c
Set 2: i and j
Set 3: w, x, y and z

Possible combinations:

a/i/w, a/i/x, a/i/y, a/i/z, a/j/w .... (24 combinations in total)
Group 2
-------
Set 1: A, B
Set 2: I, J and K

A/I, A/J, A/K, B/I .... (6 combinations in total)
So I may need to store 7 for the combination a/i/w and 2 for the
combination a/i/x etc. But at the same time I have to store perhaps 4
for A/I and 9 for A/J etc.

What is the best way of storing this in a database when the number of
sets *and* the number of elements in those sets may vary?

I cannot structure my table as:

element1 | element2 | element3 | element4 | comb_data
a | i | w | | 7
a | i | x | | 2
. | . | . | . | .
. | . | . | . | .
. | . | . | . | .
A | I | | | 4
A | J | | | 9
. | . | . | . | .
. | . | . | . | .
. | . | . | . | .

because I immediately limit the number of sets I can handle and
introduce potentially redundant columns.

Is there a best practices way to handle this scenario?

Many thanks in advance,

Louis
Nov 23 '05 #1
0 1468

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

55 posts views Thread by Jonas Smithson | last post: by
136 posts views Thread by Matt Kruse | last post: by
3 posts views Thread by xzzy | last post: by
reply views Thread by Anonieko Ramos | last post: by
2 posts views Thread by G. Dean Blake | last post: by
10 posts views Thread by jojobar | last post: by
3 posts views Thread by at_the_gonq | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.