Re: Polymorphism in RDBMS

From: Alan <alan_at_erols.com>
Date: Fri, 23 Apr 2004 12:32:53 -0400
Message-ID: <c6bgfm$a4rhh$1_at_ID-114862.news.uni-berlin.de>


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 news:I1bic.8543$YP5.716358_at_attbi_s02...
> 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

Original text of this message