资讯详情

mysql 更新操作数据丢失

开启两个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

标签: powere继电器

锐单商城拥有海量元器件数据手册IC替代型号,打造 电子元器件IC百科大全!

锐单商城 - 一站式电子元器件采购平台