if there is a table of r (c,s) and such relations (c means class, s means students), I want to know all possible combination of c1, c2, ..c5, s1,...s8 , How to write the SQL clause? I tried to write it using case when, but it's too slow. I'm using PostgreSQl.
c1:s1,s5,s7
c2:s1,s2,s3,s4
c3:s2,s6,s8
c4:s4,s5,s6
c5:s3,s7,s8