开启两个MySQL客户端,在两个客户端中对同一条数据进行更新操作。操作步骤如下:数据表
select * from customer_sales_values;
+------------+-------------+-------+--------+
| first_name | surname | value | value2 |
+------------+-------------+-------+--------+
| Patricia | Mankunku | 450 | NULL |
| Winston | Powere | 500 | NULL |
| Yohnny | Chaka-Chaka | 500 | NULL |
| Yvonne | Clegg | 4000 | NULL |
| Gladys | Malherbe | 5 | 10 |
| Johnny | Chaka-Chaka | 500 | NULL |
| Patricia | Mankunku | 450 | NULL |
| Winstoa | Powers | 750 | NULL |
| Yvoune | Clegg | 5800 | NULL |
| Charles | Dube | 0 | NULL |
| Charles | Dube | 0 | NULL |
| Gladys | Malherbe | 5 | 10 |
+------------+-------------+-------+--------+
先在window1中执行查询:
mysql> select value from customer_sales_values where
-> first_name='Johnny' and surname='Chaka-Chaka';
+-------+
| value |
+-------+
| 800 |
+-------+
1 row in set (0.05 sec)
然后在window2中执行查询:
mysql> select value from customer_sales_values where
-> first_name='Johnny' and surname='Chaka-Chaka';
+-------+
| value |
+-------+
| 800 |
+-------+
1 row in set (0.05 sec)
在window1中执行
mysql> update customer_sales_values set value=500+100
-> where first_name='Johnny' and surname='Chaka-Chaka';
Query OK, 1 row affected (0.02 sec)
Rows matched: 1 Changed: 1 Warnings: 0
在window2中执行
mysql> update customer_sales_values set value=500+300
-> where first_name='Johnny' and surname='Chaka-Chaka';
Query OK, 1 row affected (0.33 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select value from customer_sales_values where
-> first_name='Johnny' and surname='Chaka-Chaka';
+-------+
| value |
+-------+
| 800 |
+-------+
1 row in set (0.00 sec)
为什么在window1的更新操作,被在window2的更新操作覆盖了呢?不明白,请教诸位大侠!
2012年12月29日 10:18