oracle 保护表 key-preserved

 The concept of a key-preserved table is fundamental to understanding the
restrictions on modifying join views. A table is key preserved if every key of
the table can also be a key of the result of the join. So, a key-preserved
table has its keys preserved through a join.
  
Note: It is not necessary that the key or keys of a table be selected for it
to be key preserved. It is sufficient that if the key or keys were selected,
then they would also be key(s) of the result of the join.
  
Attention: The key-preserving property of a table does not depend on the
actual data in the table. It is, rather, a property of its schema and not of
the data in the table. For example, if in the EMP table there was at most one
employee in each department, then DEPT.DEPTNO would be unique in the result of
a join of EMP and DEPT, but DEPT would still not be a key-preserved table.
  
  
If you SELECT all rows from EMP_DEPT view, the results are:

  SELECT * FROM EMP_DEPT;
  
  EMPNO ENAME  SAL DEPTNO  DNAME      LOC
  ----- ------ ---- ------ ---------- --------
   7369 SMITH   800     20 RESEARCH   DALLAS
   7499 ALLEN  1600     30 SALES      CHICAGO
   7521 WARD   1250     30 SALES      CHICAGO
   7566 JONES  2975     20 RESEARCH   DALLAS
   7654 MARTIN 1250     30 SALES      CHICAGO
   7698 BLAKE  2850     30 SALES      CHICAGO
   7782 CLARK  2695     10 ACCOUNTING NEW YORK
   7788 SCOTT  3000     20 RESEARCH   DALLAS
   7839 KING   5500     10 ACCOUNTING NEW YORK
   7844 TURNER 1500     30 SALES      CHICAGO
   7876 ADAMS  1100     20 RESEARCH   DALLAS
   7900 JAMES   950     30 SALES      CHICAGO
   7902 FORD   3000     20 RESEARCH   DALLAS
   7934 MILLER 1430     10 ACCOUNTING NEW YORK

  14 rows selected.
  
In this view, EMP is a key-preserved table, because EMPNO is a key of the EMP
table, and also a key of the result of the join. DEPT is not a key-preserved
table, because although DEPTNO is a key of the DEPT table, it is not a key of
the join.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值