Theres are two option which i can help you with:
1.
You can do it using only one UPDATE query:
UPDATE emp SET gender =
CASE gender WHEN 'M' THEN 'F' WHEN 'F' THEN 'M' ELSE gender END
2.
Suppose the the table name is "Employees", gender column is "Gender" which keeps "M" for Male and "F" for female.
Then this SQL query should do the job:
UPDATE Employees, SET Gender='Z' WHERE Gender='F';
UPDATE Employees, SET Gender='F' WHERE Gender='M';
UPDATE Employees, SET Gender='M' WHERE Gender='Z';
Change the queries appropriately according to your needs.
Enjoy :)
1.
You can do it using only one UPDATE query:
UPDATE emp SET gender =
CASE gender WHEN 'M' THEN 'F' WHEN 'F' THEN 'M' ELSE gender END
2.
Suppose the the table name is "Employees", gender column is "Gender" which keeps "M" for Male and "F" for female.
Then this SQL query should do the job:
UPDATE Employees, SET Gender='Z' WHERE Gender='F';
UPDATE Employees, SET Gender='F' WHERE Gender='M';
UPDATE Employees, SET Gender='M' WHERE Gender='Z';
Change the queries appropriately according to your needs.
Enjoy :)
4 comments:
Thanks for sharing!!!
thanks
how to update the Gender column from M and F to Male and Female .
can you posibal male to female female to male and third gender to male
Post a Comment