> Hello MySQL programmers,
>
> suppose we have an Enhanced ER diagram,
> with entities as classes/ subclasses  connected through
> some IS-A  relationship.
>
> How can this be Coded in MySQL Please?
>
> My prerequisites are the basic database texts from
>
> http://www-db.stanford.edu/~ullman/dscb.html
>
> http://www.aw-bc.com/info/database/elmasri.html

My copy of elmasri has a section "EER-to_Relational Mapping," which I
followed when I wanted to do the same thing.  It lists 4 methods for
modelling EER class/subclass relationships in terms of the relational
database model.

For me, I did it as follows.  Suppose A and B are subclasses of C.  Then for
C, I had an INT for primary key, plus an ENUM to describe whether the object
was in A or B (here, the enum might have two values, 'a' and 'b').  The
primary key of A was the same as that of C; similarly for B.

The pk of A should satisfy a foreign key constraint with regard to C
(similarly for B).

If an object cannot belong to both A and B, one has to also check that no pk
in C belongs to both A and B.  That's not hard to do, but it's not clear to
me that it falls under one of the standard integrity issues in the
relational model.

HTH,

sjfromm


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to