Can update operate in batches like insert in sql database?

because batch update operations are always involved recently, I don"t know if batch operations can be performed, so we can only update, one by one in the loop
, so I"d like to ask whether there is a sql statement in the sql database that enables update to modify data in batches like insert.

for example:
account table account_info: id, name name, balance balance

INSERT INTO account_info(name,balance) values("",0),("",10),("",15)

does update have similar statements, for example, I have an array

[
    {name: "", sum: 5},
    {name: "", sum: -8},
    {name: "", sum: -10}
]
The

name corresponds to the amount one by one for one-time batch updates. Make the data in the database become

[
    {id:1, name: "", balance: 5},
    {id:2, name: "", balance: 2},
    {id:3, name: "", balance: 5}
]

not sure if there is such a way. So ask a question.

if you know, you are welcome to reply.
if you don"t know, you can collect it, in case someone answers.


-- I hope it will be helpful to you--

UPDATE account_info
  SET SUM = CASE NAME
    WHEN '' THEN 5
    WHEN '' THEN 2
    WHEN '' THEN 5
  END
WHERE id IN (1,2,3);

you have a problem with this requirement. Update is originally an update value. When inserting, Zhang San, Li Si, Wang Wu can insert many pieces of data at a time, and when updating, you can change Zhang San's name to Li Si and Wang Wu at the same time?
however, if the updated value is calculated, such as balance plus one, it can be updated together, but you don't see any regularity in this group of data


if you are using java development, the jdbc driver has batch mode, which is specifically used to execute batch insert/update statements.

search batch mode directly for other languages. I found a related article, please refer to.
http://thedebuggers.com/mysql.


update generally supports from . If you want to update balance and save the changes in the balance_change table, you can (postgresql):

.
update account set balance = account.balance + balance_change.balance
from balance_change
where account.name = balance_change.name
Menu