Swap Sex Fields
Swap Sex Fields

Given a tableĀ salary, such as the one below, that has m=male and f=female values. Swap all f and m values (i.e., change all f values to m and vice versa) with a single update query and no intermediate temp table.

For example:

After running your query, the above salary table should have the following rows:

Solution :
Approach 1:

Approach 2: