I have a table called questions containing a single column filled with Exam question IDs. Let's say:
Q1
Q2
Q2
...
Qn
Now I'd like to pick all the combinations of three questions, something like:
1, 2, 3
...
2, 5, 6
4, 7, 1
...
9, 6, 8
And seclect a subset of them made of rows that have globally unique values only. In the previous case:
1, 2, 3
9, 6, 8
Because the other two records contain 2 and 1 which are both contained in the (1, 2, 3) record.
How can this be achieved in SQL? The purpose is to create, let's say, 8 exams made of questions that are all different by each other.