DB2 基础: 物化查询表简介
2009-11-20 00:00:00 来源:WEB开发网
清单 4. 使用有关联总结表的 staging 表connect to sample
...
create table emp_summary as (select workdept, job, count(*) as count
from employee group by workdept, job)
data initially deferred refresh deferred
create table emp_summary_s for emp_summary propagate immediate
set integrity for emp_summary materialized query immediate unchecked
set integrity for emp_summary_s staging immediate unchecked
select * from emp_summary
WORKDEPT JOB COUNT
-------- -------- -----------
0 record(s) selected.
refresh table emp_summary
SQL1594W Integrity of non-incremental data remains unverified by the
database manager. SQLSTATE=01636
select * from emp_summary
WORKDEPT JOB COUNT
-------- -------- -----------
0 record(s) selected.
insert into employee
values ('006900', 'RUSS', 'L', 'DYERS', 'D44', '1234', '1960-05-05',
'FIELDREP', 5, 'M', '1940-04-02', 10000, 100, 1000)
select * from emp_summary_s
WORKDEPT JOB COUNT GLOBALTRANSID GLOBALTRANSTIME
-------- -------- ----------- -------------------... -----------------------------...
D44 FIELDREP 1 x'00000000000000CD' x'20050822201344536158000000'
1 record(s) selected.
select * from emp_summary
WORKDEPT JOB COUNT
-------- -------- -----------
0 record(s) selected.
refresh table emp_summary
SQL1594W Integrity of non-incremental data remains unverified by the database
manager. SQLSTATE=01636
select * from emp_summary
WORKDEPT JOB COUNT
-------- -------- -----------
D44 FIELDREP 1
1 record(s) selected.
connect reset
- ››db2 对float类型取char后显示科学计数法
- ››DB2中出现SQL1032N错误现象时的解决办法
- ››DB2 锁升级示例
- ››db2诊断系列之---定位锁等待问题
- ››db2 命令选项解释
- ››DB2 最佳实践: 使用 DB2 pureXML 管理 XML 数据的...
- ››DB2 9.5 SQL Procedure Developer 认证考试 735 准...
- ››DB2 9.5 SQL Procedure Developer 认证考试 735 准...
- ››DB2 9.5 SQL Procedure Developer 认证考试 735 准...
- ››DB2 基础: 表空间和缓冲池
- ››DB2 XML 编程,第 1 部分: 理解 XML 数据模型
- ››DB2 pureScale 实战
更多精彩
赞助商链接