知道数据库的记录号,怎样update这条记录?
比如一个表table(col_1,col_2,col_3,col_4)
想更新第三条记录的update set col_3=10;
条件怎么写?sql里面有没有这样的语句?
谢谢各位!
update set col_3=10
where Key = yourkey ; //如果有主鍵字段,如果沒有就麻煩點:
where col_1 = v1 and col_2 = v2 and col_3 v3 and col_4 = v4
可見主鍵字段或主索引字段對於一個表來說,是那麼的必不可少,對效率影響太大了吧。
可以写,但不建议这么做。
update yourtable
set col_3 = 3
where rowid =
(select rid
from
(select rowid rid,rownum r from yourtable t where rownum <= 3)
where r = 3);