加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Oracle_071_lesson_p19

发布时间:2020-12-12 13:26:14 所属栏目:百科 来源:网络整理
导读:Manipulating Data 数据操作 you should be able to: 1、Specify explicit default values in the INSERT and UPDATE statements 2、Describe the features of multitable INSERTs 3、Use the following types of multitable INSERTs: 4、Unconditional INSE
Manipulating Data 数据操作

you should be able to:
1、Specify explicit default values in the INSERT and UPDATE statements
2、Describe the features of multitable INSERTs
3、Use the following types of multitable INSERTs:
4、Unconditional INSERT
5、Conditional INSERT ALL
6、Conditional INSERT FIRST
7、Pivoting INSERT
8、Merge rows in a table
9、Perform flashback operations
10、Track the changes made to data over a period of time

default 值
1、default with insert:
INSERT INTO deptm3
(department_id,department_name,manager_id)
VALUES (300,‘Engineering‘,DEFAULT);

2、default with update
UPDATE deptm3
SET manager_id = DEFAULT WHERE department_id = 10;

multitable insert statements
INSERT…SELECT...

INSERT ALL
INTO target_a VALUES(…,…,…)
INTO target_b VALUES(…,…)
INTO target_c VALUES(…,…)
SELECT …
FROM sourcetab
WHERE …;

Unconditional INSERT ALL 无条件全插入
例:
create table sal_history as
select employee_id,hire_date,salary
from emp
where 1=0;

create table mgr_history as
select employee_id,manager_id,hire_date
from emp
where 1=0;

INSERT ALL INTO sal_history VALUES(EMPID,HIREDATE,SAL)INTO mgr_history VALUES(EMPID,MGR,SAL)SELECT employee_id EMPID,hire_date HIREDATE,salary SAL,manager_id MGR FROM employeesWHERE employee_id > 200;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读