Received: from smtp.snet.net (smtp.snet.net [204.60.6.55]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5SE4ma39588 for ; Thu, 28 Jun 2001 10:04:48 -0400 (EDT) (envelope-from wweng@kencast.com) Received: from pop.snet.net (pop.snet.net [204.60.6.9]) by smtp.snet.net (8.11.1/8.11.1/SNET-mx-1.4/D-1.10/O-1.7) with ESMTP id f5SE4hC12049; Thu, 28 Jun 2001 10:04:43 -0400 (EDT) Received: from [192.168.1.83] (167.95.252.64.snet.net [64.252.95.167]) by pop.snet.net (8.11.1/8.11.1/SNET-pop-1.5/D-1.8/O-1.6) with ESMTP id f5SE4gr25549; Thu, 28 Jun 2001 10:04:42 -0400 (EDT) Subject: Re: Link many attributes in one table to one attribute in another?? From: Wei Weng To: Christian Anton Cc: pgsql-sql@postgresql.org In-Reply-To: <3b3ab3aa_1@newsa.ev1.net> References: <3b3ab3aa_1@newsa.ev1.net> Content-Type: text/plain X-Mailer: Evolution/0.10 (Preview Release) Date: 28 Jun 2001 11:10:24 -0400 Message-Id: <993741034.578.1.camel@Monet> Mime-Version: 1.0 X-Archive-Number: 200106/447 X-Sequence-Number: 3748 A easy way to handle this: create table marble ( id int4 primary key, color1 int4, color2 int4, color3 int4 ); create table color ( id int4, desc text ); color1, color2, and color3 point to the id in color table. This way you can expand your color table indefinitely. On 27 Jun 2001 23:44:34 -0500, Christian Anton wrote: > Hello all, > > I am fairly new at db design, I have built a few simple in the past and have > never dealt with this type of problem before, any help would be appreciated. > > I have three attributes in one table that should reference one, and only > one, attribute in another table. Here's an analogy of the problem: > > I have a table with a list of marbles, each marble has three colors in it > (color1, color2, color3) and a serial number. In another table I have eight > colors to choose from but the list of colors grows regularly. > How do I associate a marble with three colors from the color table (a marble > may have three red sides or red-yellow-blue)? > > Thanks, > Christian > > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://www.postgresql.org/search.mpl > -- Wei Weng Network Software Engineer KenCast Inc.