X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EA2319DCA49 for ; Fri, 24 Mar 2006 14:36:46 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11453-01 for ; Fri, 24 Mar 2006 14:36:46 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.194]) by postgresql.org (Postfix) with ESMTP id 9C23C9DC944 for ; Fri, 24 Mar 2006 14:36:44 -0400 (AST) Received: by nproxy.gmail.com with SMTP id l24so273607nfc for ; Fri, 24 Mar 2006 10:36:44 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=PbtYxooMjylIyc+qZJwBettVpDcufr4D8XJbJ435hrIARhPcijOFjlk4WG3CVvEWB1pfrZKUrMb5BkvsB6eZQfDzoLOwkmG5533jQizElFL97Of4k7TvddG1TICQQqwurWrJIGqS8JJwxUSCTTIHmo8V/Gn/Z8oX+5vwaSpsJ+c= Received: by 10.49.40.8 with SMTP id s8mr389282nfj; Fri, 24 Mar 2006 10:36:44 -0800 (PST) Received: by 10.49.17.3 with HTTP; Fri, 24 Mar 2006 10:36:44 -0800 (PST) Message-ID: <226d83de0603241036n3795047fy412f076f23f7be1c@mail.gmail.com> Date: Fri, 24 Mar 2006 13:36:44 -0500 From: "Todd Kennedy" To: Joe Subject: Re: Question about One to Many relationships Cc: "D'Arcy J.M. Cain" , pgsql-sql@postgresql.org In-Reply-To: <44243BBA.8030802@freedomcircle.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <226d83de0603240852q54af3512odfce218d69718c8b@mail.gmail.com> <20060324120142.d3fdf477.darcy@druid.net> <226d83de0603240937o7b5608f9je5179238ee3c9c5a@mail.gmail.com> <44243BBA.8030802@freedomcircle.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200603/384 X-Sequence-Number: 24730 We're not concerned with the track info. This is a listing of album information, hence the one to many relationship between the album and the artist. and for the record, i should correct myself. he said it was "bad" not "wro= ng". but i hadn't given him all the details. But. Yes. Thank you all for your help. On 3/24/06, Joe wrote: > Todd Kennedy wrote: > > They haven't responded me as of yet. There should be a band associated > > with each album -- this is handled in code, but other than that this > > is the only relational db way I can think of to do it. > > But if a band can have songs in many albums and an album can have songs > from multiple bands, it's a many-to-many relationship, NOT one-to-many. > Short of the full track design suggested by PFC, you'd normally > implement a many-to-many table as follows: > > CREATE TABLE bands_on_album ( > band_id integer REFERENCES band (id), > album_id integer REFERENCES albums (id), > PRIMARY KEY (band_id, album_id) > ) > > This of course precludes the same band being listed twice in a given > album. If you do need that info, then you're really asking for "tracks". > > Joe > >