Re: many-to-many relationship

Поиск
Список
Период
Сортировка
От Louis-David Mitterrand
Тема Re: many-to-many relationship
Дата
Msg-id 20081006152532.GA29877@apartia.fr
обсуждение исходный текст
Ответ на Re: many-to-many relationship  (Dave Steinberg <dave-pgsql@redterror.net>)
Список 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.

-- 
http://www.lesculturelles.net


В списке pgsql-sql по дате отправления:

Предыдущее
От: Dave Steinberg
Дата:
Сообщение: Re: many-to-many relationship
Следующее
От: Emi Lu
Дата:
Сообщение: pg_dump more than one table in one command?