2014-11-03 56 views

回答

2

太長的評論。

根據標準SQL的規則,它將爲20。在update聲明結束之前,新值不會被提交。它們不是逐行或逐列地提交的。記住數據庫的ACID屬性 - 所有更改將同時生效。

有可能某些數據庫沒有這種行爲。在實踐中檢查很容易。

+1

MySQL不會產生這個結果。 – 2014-11-03 14:47:46

1

該列將顯示20

更新函數作爲批量運行。

你可以這樣做快速測試:

/* Create Test Table 
select 
10 as col1, 
0 as col2 
into TestTable 
*/ 

/* update 
update TestTable 
set col1 = 20, 
col2 = col1 + 10 
*/ 

select * from TestTable