0

Assume that I have a table with N columns. And I need a subset for all combinations of columns. For example, If there are C1,C2,.....,Cn columns, I need

1D = {C1,C2,C3,C4,.....,Cn}
2D = {C1C2,C2C3,C1C3,.....,Cn-1Cn} // 2D is all combination set for 2 columns.
3D = {C1C2C3,C1C2C4,C1C2C5,......}

...

I will use Vector<Vector<String>> setofNDSubset. (java) I think it will be Vector(1D,2D,3D,......,ND). And I use jdbc. Column number should be less than 10.

I need some advices for you. Thanks.

APC
  • 137,061
  • 19
  • 153
  • 266
yong
  • 37
  • 7
  • 3
    is this about the appropriate SQL-query, or do you want to construct the set in java? In either way be prepared that the output-size will explode. – Paul Feb 06 '17 at 03:30
  • What's the background for this question? – mathguy Feb 06 '17 at 04:02
  • I want to construct the set in java. – yong Feb 06 '17 at 04:32
  • Column number should be less than 10, so i think it won't be explode. – yong Feb 06 '17 at 04:33
  • If you're not interested in subsets smaller than `N` then search for permutations generation algorithm. For example: [1](https://stackoverflow.com/questions/4240080/generating-all-permutations-of-a-given-string), [2](https://stackoverflow.com/questions/10305153/generating-all-possible-permutations-of-a-list-recursively) – default locale Feb 06 '17 at 04:36

0 Answers0