oracle 保護表 key-preserved

來源:互聯網
上載者:User
 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.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.