Suppose we have two columns and we know possible values:
a = [1,2]
b = [1,2,3]
So, the table with all combinations will be:
a, b
----
1, 1
1, 2
1, 3
2, 1
2, 2
2, 3
But what if the table is not full?:
a, b
----
1, 1
--
--
--
2, 2
2, 3
How to find the missing combinations?:
a, b
----
1, 2
1, 3
2, 1
P.S. The table is quite large actually, it contains 1-2 million records.
It contains other values, not only that we have to check, those values should be ignored.
Actually, it is not necessary to get all the missing combinations.
Find at least one is enough.