From: | Louis-David Mitterrand <vindex+lists-pgsql-sql(at)apartia(dot)org> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: many-to-many relationship |
Date: | 2008-10-06 15:25:32 |
Message-ID: | 20081006152532.GA29877@apartia.fr |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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 for the table.
On Mon, Oct 06, 2008 at 09:30:41AM -0400, Dave Steinberg wrote:
> The typical way to do this would be to have your image table be just
> about images, and then to isolate the relationship information into
> mapping tables. Those would look like:
>
> image <=> people
> (image_id, person_id), with the primary key being the pair of columns.
> In SQL, roughly:
Thanks Dan and Dave,
you suggested the same solution which seems the most reasonable.
From | Date | Subject | |
---|---|---|---|
Next Message | Emi Lu | 2008-10-06 21:02:50 | pg_dump more than one table in one command? |
Previous Message | Dave Steinberg | 2008-10-06 13:30:41 | Re: many-to-many relationship |