Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

sql replace value condition

# change gender from male to female, and from female to male
UPDATE salary SET sex =
CASE sex
    WHEN 'm' THEN 'f'
    ELSE 'm'
END;

# or 

update Salary set sex = if(sex='m', 'f', 'm');
Source by www.sqltutorial.org #
 
PREVIOUS NEXT
Tagged: #sql #replace #condition
ADD COMMENT
Topic
Name
6+6 =