Re: Multiway associations

Поиск
Список
Период
Сортировка
От Paul Thomas
Тема Re: Multiway associations
Дата
Msg-id 20040125103457.A22981@bacon
обсуждение исходный текст
Ответ на Multiway associations  (Russell Shaw <rjshaw@iprimus.com.au>)
Список pgsql-general
On 25/01/2004 05:06 Russell Shaw wrote:
> Hi,
> I'm making my first database.
>
> I have a list of parts, each of which is sold by multiple
> vendors. I also have a list of vendors, each of which sell
> multiple parts.
>
> How should i arrange the tables for this that doesn't involve
> having lots of empty fields "just in case" ?


One way would be to have a separate vendorpart table something like

CREATE TABLE vendorpart
(
   vendor_id      int4,
   part_id        int4
);

which holds the relationships. You'll to define indexes, contraints and
foreign keys on it.
--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for the Smaller
Business |
| Computer Consultants         |
http://www.thomas-micro-systems-ltd.co.uk   |
+------------------------------+---------------------------------------------+

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

Предыдущее
От: "Chris Travers"
Дата:
Сообщение: Re: OT: SCO Extortion
Следующее
От: "Chris Travers"
Дата:
Сообщение: Re: OT: SCO Extortion