在oracle中,數(shù)據(jù)修改語句是update語句,該語句的作用就是修改表中指定的數(shù)據(jù),語法為“UPDATE 表名稱 SET 列名稱 = 新值 WHERE 條件”。
本教程操作環(huán)境:Windows10系統(tǒng)、Oracle 11g版、Dell G3電腦。
oracle數(shù)據(jù)修改語句是什么
Oracle 中 update語句的用途是用于修改表中的數(shù)據(jù)。
語法:
UPDATE 表名稱 SET 列名稱 = 新值 <WHERE 條件>.
如,數(shù)據(jù)庫中,test表數(shù)據(jù)如下:
現(xiàn)在要將王五的名字改成王九,可用如下語句:
update test set name='王九' where name='王五'; commit;
執(zhí)行后結果:
1、比如說修改某列數(shù)據(jù),update studentinfo set studentsex='女' where studentid=1;select * from studentinfo。
2、修改某幾列數(shù)據(jù),update studentinfo set studentname='李五',studentsex='女',studentage=15;where studentid=2;commit;select * from studentinfo。
3、清空某幾個數(shù)據(jù),比如張山的sex,update studentinfo set studenttel=null where studentid=1;commit;select * from studentinfo。
4、將所有數(shù)據(jù)中的age設置為女,update studentinfo set studentsex='女';commit。
5、對表中的數(shù)據(jù)進行想加運算,將張山的年齡增加10歲,update studentinfo set studentage=studentage+10 where studentid=1;commit。
6、對表中的數(shù)據(jù)進行相乘運算,將王五的年齡乘3歲,update studentinfo set studentage=studentage*3 where studentid=3;commit;select * from studentinfo。
推薦教程:《Oracle視頻教程》