开启两个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)
然后在window二中执行查询:
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