title: Interview : update table values using select statement
body: <p>Interviewer asked me one question, which seems very easy, but I couldn't figure out, how to solve this</p>
  
  <pre><code>Name  | Gender
  --------------
  A     | F
  B     | M
  C     | F
  D     | F
  E     | M
  </code></pre>
  
  <p>From the above data, gender was wrongly entered, which means in place of <code>F</code> it should be <code>M</code> and in place of <code>M</code> it should <code>F</code>. How to update whole table with a single line sql query (don't use pl/sql block). Since, if I will update gender column one by one, then possible error would be all rows values of gender column becomes either <code>F</code> or <code>M</code>.</p>
  
  <p>Final output should be</p>
  
  <pre><code>Name  | Gender
  --------------
  A     | M
  B     | F
  C     | M
  D     | M
  E     | F
  </code></pre>