Best practices for subclassing entities in relational database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

What are the best practices for subclassing entities in relational databases?

The most efficient/fastest way is to use one table for all subclasses.
But sometimes this is not very... err... nice. Especially for nicely
complex hierarchy. In the OOP world Everything(tm) can descend from
the Object class. But then do you just create one "objects" table and
then expect every entity to be there?

I'm currently developing a database system with only two entities,
Persons and Topics (things attached to persons, like their e-mail
addresses, books read, movies liked, basically anything and nothing in
general, etc.) Actually persons are also topics in the proper sense of
hierarchy (just like the Topic Map model -- http://www.topicmap.org),
but when converted to relational it gets messy. The thing is I also
need to add associations between these entities.

And so I have to have relationship entities (person-to-person
relationship), association entities (person-to-topic relationship),
and yet another association entities (topic-to-topic relationship). In
the OOP world I would only need two base classes (topics and
associations), but in the relational world this gets transformed to 5
entities, and more for the many-to-many join tables (i.e. a
association entity has a association types table and a association
many-to-many table).

I would appreciate any suggestions.
-- 
Hendy Irawan
http://www.gauldong.net
http://dev.gauldong.net

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux