mysql原值增加的方法:使用updata函數(shù),格式為【update 表名稱 set 字段名稱 = 字段名稱 + 1 [ where語句]】。
mysql原值增加的方法:
格式:
update 表名稱 set 字段名稱 = 字段名稱 + 1 [ where語句]
比如說數(shù)據(jù)庫中有一張student表,要想把id為1的學(xué)生成績(jī)(score)加1則
update student set score=score+1 where id = 1
如果你不加where系統(tǒng)就不會(huì)知道你具體要更新哪條記錄,而導(dǎo)致所有該表中score都增加1,當(dāng)然,除非這就是你的本意。