In Oracle, you can use the "update" command to modify the value of a column. This statement can be used to modify and update the data of one or more tables. The syntax is "update table name set column name 1=value 1, column name 2 = value 2, column name 3 = value 3.... where condition".
The operating environment of this tutorial: Windows 7 system, Oracle 11g version, Dell G3 computer.
In Oracle, you can use the "update" command to modify the value of a column.
The update statement can be used to modify and update data in one or more tables.
Grammar:
update 表名 set 列名1=值1,列名2=值2,列名3=值3..... where 条件
Case 1. Update the age and ID card information of student "Zhang San":
update student.stuinfo t set t.age = '24', t.idnumber = '3503021994XXXXXXXX' where t.stuname = '张三'; commit; select * from student.stuinfo t where t.stuname='张三';
The results are as follows:
update The command structure to update the data in this table using another table association is as follows:
update 表1 set 列名=(select 列名 from 表2 where 表1.列名=表2.列名) where exists (select 1 from 表2 where 表1.列名=表2.列名)
Case 2, update back using the backup table stuinfo_2018 The age and ID card of student "Zhang San":
update student.stuinfo t set (age, idnumber) = (select age, idnumber from student.stuinfo_2018 b where b.stuid = t.stuid) where exists (select 1 from student.stuinfo_2018 b where b.stuid = t.stuid and b.stuname = '张三'); select *from student.stuinfo t where t.stuname='张三';
The results are as follows:
## Recommended tutorial: "Oracle Tutorial》
The above is the detailed content of How to modify column value in oracle. For more information, please follow other related articles on the PHP Chinese website!