Re: [SQL] many-to-many relationship

2008-10-09 Thread Steve Midgley
At 05:20 PM 10/8/2008, [EMAIL PROTECTED] wrote: Date: Wed, 8 Oct 2008 11:25:10 +0200 From: Louis-David Mitterrand <[EMAIL PROTECTED]> To: pgsql-sql@postgresql.org Subject: Re: many-to-many relationship Message-ID: <[EMAIL PROTECTED]> Mail-Followup-To: pgsql-sql@postgresql.org References: <[EMAIL

Re: [SQL] many-to-many relationship

2008-10-08 Thread Louis-David Mitterrand
On Tue, Oct 07, 2008 at 05:16:39PM -0700, Steve Midgley wrote: > > I think the relationship tables method works pretty well but I have > another suggestion. You could store the Foreign table name within image > table as well as the Foreign key. > > |id|image_url|f_table|f_key > |1 |url..|pe

Re: [SQL] many-to-many relationship

2008-10-07 Thread Steve Midgley
At 06:20 AM 10/7/2008, [EMAIL PROTECTED] wrote: Date: Mon, 6 Oct 2008 15:08:02 +0200 From: Louis-David Mitterrand <[EMAIL PROTECTED]> To: pgsql-sql@postgresql.org Subject: many-to-many relationship Message-ID: <[EMAIL PROTECTED]> X-Archive-Number: 200810/13 X-Sequence-Number: 31655 Hi, Say you

Re: [SQL] many-to-many relationship

2008-10-06 Thread Louis-David Mitterrand
On Mon, Oct 06, 2008 at 09:25:09AM -0400, Dan McFadyen wrote: > Hello, > > Simplest way I can think of is create 3 relation tables, a person/image > table, location/image table and event/image table. > > Each is just made up for 2 foreign keys to the first ID and image ID, > using both as the PK

Re: [SQL] many-to-many relationship

2008-10-06 Thread Dave Steinberg
Louis-David Mitterrand wrote: Hi, Say you have several objects (tables): person, location, event, etc. all of which can have several images attached. What is the best way to manage relations between a single 'image' table and these different objects? For now each 'image' row has pointers to id

[SQL] many-to-many relationship

2008-10-06 Thread Louis-David Mitterrand
Hi, Say you have several objects (tables): person, location, event, etc. all of which can have several images attached. What is the best way to manage relations between a single 'image' table and these different objects? For now each 'image' row has pointers to id_person, id_location, id_event,