Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: what is a key-preserved table?
Oracle8i Application Developer's Guide - Fundamentals
Release 8.1.5
A68003-01
Key-Preserved Tables
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.
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.
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_TAB table there was at most one employee in each department, then DEPT_TAB.DEPTNO would be unique in the result of a join of EMP_TAB and DEPT_TAB, but DEPT_TAB would still not be a key-preserved table.
If you SELECT all rows from EMP_DEPT_VIEW defined in the "Modifying a Join View" section, then the results are:
EMPNO ENAME DEPTNO DNAME LOC
7782 CLARK 10 ACCOUNTING NEW YORK 7839 KING 10 ACCOUNTING NEW YORK 7934 MILLER 10 ACCOUNTING NEW YORK 7369 SMITH 20 RESEARCH DALLAS 7876 ADAMS 20 RESEARCH DALLAS 7902 FORD 20 RESEARCH DALLAS 7788 SCOTT 20 RESEARCH DALLAS 7566 JONES 20 RESEARCH DALLAS8 rows selected.
In this view, EMP_TAB is a key-preserved table, because EMPNO is a key of the EMP_TAB table, and also a key of the result of the join. DEPT_TAB is not a key-preserved table, because although DEPTNO is a key of the DEPT_TAB table, it is not a key of the join.
--
WBR Sergey
Maggie <maggiezhou_at_hotmail.com> ÓÏÏÂÝÉÌ × ÎÏ×ÏÓÔÑÈ
ÓÌÅÄÕÀÝÅÅ:8c1hv0$uv$1_at_web1.cup.hp.com...
> I could not find its definition from Oracle Reference, please help.
>
> Thanks
>
>
>
Received on Fri Mar 31 2000 - 01:32:06 CST
![]() |
![]() |