Re: Polymorphism in RDBMS
Date: Fri, 23 Apr 2004 12:32:53 -0400
What you've got there is wrong. If one field or the other must be null, then you need the two tables you started with. Polymorphism is an OO concept, and is not supported directly in an RDBMS. Why do you think you need to combine them?
"Ian Pilcher" <i.pilcher_at_comcast.net> wrote in message
> Hi all -
> I am trying to design a schema for my super-duper, ultimate web-based
> jukebox. One of the things I want to do is break out of the simplistic
> artist/album/song hierarchy that is such a poor fit for jazz and
> classical music.
> Since I want to store detailed information on "artists", I obviously
> need to treat groups (such as Led Zeppelin or the London Symphony
> Orchestra) differently from individuals. Assume that I have two tables,
> 'group_info' and 'person_info', which store this information. (Each
> table has a primary key named 'id'.)
> My challenge is to create an 'artist_info' table. Currently, I've come
> up with:
> id | group_id | person_id
> | |
> | |
> where either group_id *OR* person_id must be null.
> Any other ideas?
> Ian Pilcher i.pilcher_at_comcast.net
Received on Fri Apr 23 2004 - 18:32:53 CEST