title: Using SQL to find all possible combinations of column variables
body: <p>I have a table in SQL which has N columns. Call them "Col1", "Col2", ..., "ColN". I can find out how many unique elements there are in Col1 by the query:</p>
  
  <p><code>select count(distinct Col1) from mytable</code></p>
  
  <p>and I can do this, independently for each column. Assuming I have M_1 unique elements in Col1, M_2 in Col2, etc., what single command can I use to find the total number of all possible combinations for my dataset? That is, what single query would calculate (M_1*M_2*...*M_N) for me?</p>
  
  <p>PS: very new to SQL here, so I'm not sure if this matters - but I am using MySQL Workbench on Windows.</p>