title: How to split table into two tables based on column value in sql?
body: <p>I need to split a table into two tables based on a value of column by creating two tables in <code>data-base</code> for example:</p>
  
  <p>I have a table as the below</p>
  
  <p><code>table1</code></p>
  
  <pre><code>|---------------------|------------------|
  |        Col1         |     Col2         |
  |---------------------|------------------|
  |         1           |         a        |
  |---------------------|------------------|
  |         2           |         a        |
  |---------------------|------------------|
  |         3           |         b        |
  |---------------------|------------------|
  |         4           |         a        |
  |---------------------|------------------|
  |         5           |         b        |
  |---------------------|------------------|
  |         6           |         b        |
  |---------------------|------------------|
  |         7           |         a        |
  |---------------------|------------------|
  </code></pre>
  
  <p>and the result I want to be like this as the below tables</p>
  
  <p><code>table2</code></p>
  
  <pre><code>|---------------------|------------------|
  |        Col1         |     Col2         |
  |---------------------|------------------|
  |         1           |         a        |
  |---------------------|------------------|
  |         2           |         a        |
  |---------------------|------------------|
  |         4           |         a        |
  |---------------------|------------------|
  |         7           |         a        |
  |---------------------|------------------|
  </code></pre>
  
  <p><code>table3</code></p>
  
  <pre><code>|---------------------|------------------|
  |        Col1         |     Col2         |
  |---------------------|------------------|
  |         3           |         b        |
  |---------------------|------------------|
  |         5           |         b        |
  |---------------------|------------------|
  |         6           |         b        |
  |---------------------|------------------|
  </code></pre>