Is there a way in MySQL to reverse a boolean field with one query?
To update (boolean) value normally we would check if it’s set to false or true, and update it, I was wondering if there’s query that would toggle boolean value.
UPDATE mytbl SET field = !field WHERE id = 42
42 is the
id of the record,
field is the name of the boolean field and
mytbl is the table name.
You can use Boolean Operator for this Here delete is your boolean field.
update tab set `delete`=NOT `delete`