Update multiple rows with one query?

Solution 1:

UPDATE person
    SET name = CASE id
        WHEN 1 THEN 'Jim'
        WHEN 2 THEN 'Mike'
        WHEN 3 THEN 'Precious'
    END,
    sex = CASE id
        WHEN 1 THEN 'female'
        WHEN 2 THEN 'male'
        WHEN 3 THEN 'male'
    END
WHERE id IN (1,2,3)

Solution 2:

Have you tried something like below. You can have multiple "SET" statements one for each column.

UPDATE person 
    SET name = CASE id 
        WHEN 1 THEN 'Jim' 
        WHEN 2 THEN 'Mike' 
        WHEN 3 THEN 'Precious' 
    END, 
    sex = CASE id 
        WHEN 1 THEN 'female' 
        WHEN 2 THEN 'male' 
        WHEN 3 THEN 'male' 
    END 
WHERE id IN (1,2,3)