且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为什么受影响的行在更新/删除成功时返回0?

更新时间:2023-02-07 18:31:01

最可能的解释是,没有满足UPDATE和DELETE语句中条件的行.也就是说,没有id值等于1的行.

The most likely explanation is that there are no rows that satisfy the conditions in the UPDATE and DELETE statements. That is, there are no rows with id value equal to 1.

如果条件匹配一个或多个行,则UPDATE可能会影响零行,但是应用于该行的更改将导致无更改"……也就是说,被修改的列已经分配了值.

An UPDATE could affect zero rows if the conditions match one or more rows, but the changes applied to the row result in "no change"... that is, the columns being modified already have the values being assigned.

成功执行但影响零行的UPDATE或DELETE仍然被认为是成功的.

An UPDATE or DELETE that executes successfully, but affects zero rows, is still considered successful.