SQL and unique n-column combinations
Your query for 2 columns could be rewritten like this:
SELECT
c1.n,
c2.n
FROM combinations c1
INNER JOIN combinations c2 ON c1.n < c2.n
For 3 columns you would then need to make some additions (highlighted in bold):
SELECT
c1.n,
c2.n,
c3.n
FROM combinations c1
INNER JOIN combinations c2 ON c1.n < c2.n
INNER JOIN combinations c3 ON c2.n < c3.n
I'm sure you can now easily guess how to scale this for more columns.