Having an optional foreign key (ie. sometimes NULL) ?
От | Tom |
---|---|
Тема | Having an optional foreign key (ie. sometimes NULL) ? |
Дата | |
Msg-id | 1047596316.3e710d1c84742@IMP-3.2 обсуждение исходный текст |
Ответы |
Re: Having an optional foreign key (ie. sometimes NULL) ?
Re: Having an optional foreign key (ie. sometimes NULL) ? |
Список | pgsql-general |
Hello, I have the following tables: - company (eg. ABC Shipping Inc.) - product (eg. table, chair, pen, pencil) - client (eg. Joe's Insurance Company) and they relate to each other as follows: - a company has clients (company is a foreign key in client) - a company sells products (company is a foreign key in client) which is all well and good until I come to one specification in my design document which says that "some products will only be available to a single client whereas other products will be available to all clients". I thought the best way to get around this would be to have the client as a foreign key in products but for products available to all clients this won't work. Can someone advise how I can overcome this? Thanks, Tom.
В списке pgsql-general по дате отправления: