更新數據使用的是【update】命令
直接賦值更新
1. 語法
update 數據表
set 字段名1=新的賦值,字段名2=新的賦值,……
where 條件
2. 實例
在【命令編輯區】執行以下語句。
―――――――――――――――――――――――――――――――――――――
update scott.emp
set empno=8888,ename='TOM',hiredate='03-9月 -2002 '
where empno=7566;
嵌套更新
1. 語法
update 數據表
set 字段名1=(select 字段列表 from 數據表 where 條件),字段名2=(select 字段列表
from 數據表 where 條件),……
2. 實例
在【命令編輯區】執行以下語句。
―――――――――――――――――――――――――――――――――――――
update scott.emp
set sal=
(
select sal+300 from scott.emp
where empno=7599
)
where empno=7599;