Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: The Third Manefesto
Hi Henri,
I think the two issues are orthogonal. every relvar is based on a set of attributes, and every attribute is associated with a type. that is, a type of arbitrary complexity. so indeed, you can "hide" or encapsulate several employee properties into a single attribute if you like.
regardless how complicated you choose your relvar attributes, once that exercise is done you must assign (candidate) keys for that relvar. a candidate key is just a subset of the relvar heading (and the heading is the set of attributes) with the property that it uniquely identifies every tuple. well, a trivial key is the heading itself -- and if your relvar only has one attribute, that attribute *must* be the key ...
hope this helps,
kind regards,
Lex.
-----Original Message-----
From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On
Behalf Of Henry Poras
Sent: Wednesday, July 20, 2005 08:17
To: oracle-l_at_freelists.org
Subject: The Third Manefesto
I'm almost done reading Date's book. I have a bunch of questions and need to reread and think about a number of sections. There is one basic question, though, where I am convinced I must be missing something.
How do you apply Foreign Keys if relations are defined using relational types?
One example given by Date is logically representing employee data either in a relation variable (EMP) with attributes empno, ename, deptno, ... OR by defining a type emp(empno, ename, deptno, ...). This type is then the data type (domain) of an EMP relvar. The second relation is thus effectively a set of employee objects.
I see how joins can be done in the second case (use a built-in funtion THE_DEPTNO(emp) which will extract the deptno value from each tuple), but what about a foreign key on DEPTNO?
If I read this in the morning and the question is as unclear as I suppose it is, I'll expound on this.
Henry
--
http://www.freelists.org/webpage/oracle-l
--
http://www.freelists.org/webpage/oracle-l
Received on Wed Jul 20 2005 - 02:57:17 CDT
![]() |
![]() |