pivoting insert(旋转插入
来源:互联网 发布:ajax引用json文件 编辑:程序博客网 时间:2024/06/06 09:45
这节主要讨论使用pivoting insert 实现将非关系性表记录转换为关系型表中存储。Pivot 旋转是OLAP中的一个基本改变,提供多维度数据分析。比如一个表为sales_source_data,里面的列为
employee_id number,week_id number,sales_mon number,sales_tuenumber,sales_wed number,sales_thur number,sales_fri number员工id,周id,其他的是工作日的每天的销售记录。
现在要把数据转到sales_info表中,这个表的列为employee_id,week_id,sales。
要实现这个转换可以使用pivoting insert 操作。和insertall类似,只不过这里的多表都是同一个表。
insert all
into sales_info values(employee_id,week_id,sales_mon)--分别按每个工作日插入
into sales_info values(employee_id,week_id,sales_tue)
into sales_info values(employee_id,week_id,sales_wed)
into sales_info values(employee_id,week_id,sales_thur)
into sales_info values(employee_id,week_id,sales_fri)
selectemployee_id,week_id,sales_mon,sales_tue,sales_wed,sales_thur,sales_fri
from sales_source_data;
比如原来的sales_source_data 中只有一条记录,那么插入到sales_info 中就变成了5 条记录。
select * from sales_source_data;
select * from sales_info;
- pivoting insert(旋转插入
- pivoting insert(旋转插入)
- pivoting insert(旋转插入)
- [每日一题] OCP1z0-047 :2013-07-28 多表插入――pivoting insert(旋转插入)....................17
- OCP-047 Pivoting INSERT
- insert all/ insert first/ pivoting insert
- ORACLE之pivoting insert等
- oracle pivoting insert 用法简介
- 关于pivoting insert ,conditional insert(备忘)
- sql技术:聚合旋转操作 pivoting 技术
- Extensions to DML and DDL Statements(pivoting insert)
- 【转载】多表插入INSERT ALL…
- 插入(insert)
- INSERT ... ON DUP…
- Oracle 旋转insert(insert all/first)
- insert插入触发器
- insert select 插入语句
- insert into 插入语句
- hot patching
- merge 的使用
- Oralce 系统用户介绍
- oracle 中的INTERVAL 函…
- oracle group by中cube…
- pivoting insert(旋转插入
- Commit或Rollback前的数据状态
- SecureCRT右键粘贴的设置
- oracle unlock\lock user account
- Install ssh for AIX
- 屌丝 c++语言程序设计 第三章 运算符和表达式
- 与NULL值的使用有关
- 去除DVSDK中的ubuntu版本限制
- Enabling Fast Incremental Backup