3 solution in MySQL : using case, when and if
All of three are pretty alike.\n\n1. simply case, when, else\n\nupdate salary \nset sex = case sex when \'m\' then \'f\' else \'m\' end\n\n2. specific case writ
All of three are pretty alike.\n\n1. simply case, when, else\n```\nupdate salary \nset sex = case sex when \'m\' then \'f\' else \'m\' end\n```\n2. specific case written\n```\n# update salary \nset sex = case sex when \'m\' then \'f\'\n                   when \'f\' then \'m\' end\nwhere sex in (\'m\', \'f\')\n```\n3. if function\n```\n#IF\nupdate salary\nset sex = if(sex = \'m\', \'f\', \'m\') where sex in (\'m\', \'f\')\n```
['MySQL']