title: I have a table "Student", now I would like to query the result as same as the second table. One group must have 2 students.
body: <p>I have a table <code>Student</code>, now I would like to query the result the same as the second table. One group must have 2 students.</p>
  
  <pre><code>Student ID    Name    Gender    Group
  1             A       M         A1
  2             B       F         A1
  3             C       M         A2
  4             D       M         A2
  5             E       F         A3
  6             F       F         A3     
  </code></pre>
  
  
  
  <pre><code>Name1    Gender1    Name2    Gender2    Group
  A        M          B        F          A1
  C        M          D        M          A2
  E        F          F        F          A3
  </code></pre>