Question: How do you change value of gender column from F (Female) to M (Male) and from M to F in the employee table.
Here are few possible solutions:
1.
UPDATE employee SET gender =
CASE gender WHEN ‘M’ THEN ‘F’ WHEN ‘F’ THEN ‘M’ ELSE gender END
UPDATE employee SET gender =
CASE gender WHEN ‘M’ THEN ‘F’ WHEN ‘F’ THEN ‘M’ ELSE gender END
2.
UPDATE Employee SET Gender=’Z’ WHERE Gender=’F’;
UPDATE Employee SET Gender=’F’ WHERE Gender=’M’;
UPDATE Employee SET Gender=’M’ WHERE Gender=’Z’;
UPDATE Employee SET Gender=’Z’ WHERE Gender=’F’;
UPDATE Employee SET Gender=’F’ WHERE Gender=’M’;
UPDATE Employee SET Gender=’M’ WHERE Gender=’Z’;
No comments:
Post a Comment