Database table update using single mysql query
Many ways to do this.

One way is using case when ... (assuming no NULLs or other gender values):

update yourtable set gender = (case when gender ='F' then 'M' else 'F' end);