Why affected rows return 0 while update/delete success?

后端 未结 1 593
傲寒
傲寒 2021-01-23 10:42

I have statements:

INSERT INTO infotbl(name, phone) VALUES(\'Alex\', \'9999999\');

and update it:

UPDATE infot         


        
相关标签:
1条回答
  • 2021-01-23 10:55

    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.

    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.

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

    0 讨论(0)
提交回复
热议问题