Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Implementing complicated constraints
On 1 Oct 2004 02:12:59 -0700, Tony Andrews wrote:
> Brian Dick wrote:
>> We go out of sync somewhere. Here's my translation. Looks normalized
>> >> Table LOCATION (loc, >> pk(loc)) >> >> Table DEPT ( deptno, loc, >> pk(deptno, loc), >> fk(loc) references LOCATION) >> >> Table NICKNAME( loc, nickname, >> pk(loc,nickname) >> fk(loc) references LOCATION) >> >> Table EMP( empno, deptno, loc, nickname >> pk(empno, deptno, loc), >> fk(deptno, loc) references DEPT, >> fk(loc, nickname) references NICKNAME)
I didn't see the requirement for globally unique dept.deptno. So, just add the uk(dept.deptno) IN ADDITION TO the pk(deptno, loc). Same for Emp, too. This doesn't change the relationships between the tables or between the columns within a table.
Now we have.
Table LOCATION (loc,
pk(loc)) Table DEPT ( deptno, loc, pk(deptno, loc), uk(deptno), fk(loc) references LOCATION) Table NICKNAME( loc, nickname, pk(loc,nickname) fk(loc) references LOCATION) Table EMP( empno, deptno, loc, nickname pk(empno, deptno, loc), uk(empno), fk(deptno, loc) references DEPT, fk(loc, nickname) references NICKNAME)Received on Fri Oct 01 2004 - 13:42:33 CDT