int c = a;
a = b;
b = c;
####
a = a^b;
b = a^b;
a = a^b;
##
##
of a=1 and b=0.
a = a^b = 1 xor 0 = 1
b = a^b = 1 xor 0 = 1
a = a^b = 1 xor 1 = 0
##
##
mysql> select * from test;
+------+------+
| id | num |
+------+------+
| 1 | 100 |
| 2 | 200 |
+------+------+
2 rows in set (0.00 sec)
mysql> update test set id=666 where id=1; update test set id=1 where id=2; update test set id=2 where id=666;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from test;
+------+------+
| id | num |
+------+------+
| 2 | 100 |
| 1 | 200 |
+------+------+
2 rows in set (0.00 sec)
mysql>