How to update multiple ids at once How to update multiple ids at once sql sql

How to update multiple ids at once


This for using where clause :

 UPDATE employees SET gender = 'Male' WHERE id IN (1,2,3)

If you want update all rows in table then:

UPDATE employees SET gender = 'Male'  


You can use the same thing, but for the ID's you can use ID's in

Like this:

 .... where id in (1,2,3);

You can also write a nested query inside IN.

For more details on how to write IN you can refer here.