Repeatable-read can be read repeatedly, and the contents of the Select table in set autocommit= 0 or start transaction state will not change. This isolation level may result in something that has been read that has been modified.
Like what:
Read a field in one row a=1
In reply two, this field modifies the a=0 and submits
And then update this field a=0, you will find that the number of affected rows is 0, so you can determine whether the change was successful based on the number of rows affected by 0 or 1.
This can be useful in some programs!
Session 1:
Mysql> set autocommit=0;
Query OK, 0 rows Affected (0.00 sec)
Mysql> SELECT * from Test.dd where id=1;
+----+------+
| ID | AA |
+----+------+
| 1 | 2 |
+----+------+
1 row in Set (0.00 sec)
Session 2:
mysql> Update test.dd set aa=1 where id=1;
Query OK, 1 row affected (0.09 sec)
Rows matched:1 changed:1 warnings:0
Session 3:
Mysql> SELECT * from Test.dd where id=1;
+----+------+
| ID | AA |
+----+------+
| 1 | 2 |
+----+------+
1 row in Set (0.00 sec)
mysql> Update test.dd set aa=1 where id=1;
Query OK, 0 rows Affected (0.00 sec)
Rows matched:1 changed:0 warnings:0
The number of affected rows here is 0, and we can determine whether the update was successful based on this value, which is useful when you need to change the status of some rows!