Re: doubt

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: doubt
Дата
Msg-id 40CDE5AE.30405@archonet.com
обсуждение исходный текст
Ответ на doubt  (sathish <sathish@ceedees.com>)
Ответы Re: doubt  (Laura Vance <vancel@winfreeacademy.com>)
Список pgsql-general
sathish wrote:
> dear groups,
>    i have a doubt in sql,
>    i have a table staff_skills in which i have set a table level
> constraint to create a primary key of two fields .
>    so 'name' and 'skill' combinedly forms a primary key.
>    now the issue is in another table i have only 'name' field and i want
> to create a foreign key constraint which refers the staff_skills table's
> 'name' field only.
>   staff_skills (table) - name,skill,ability  (columns)   ---  primary
> key(name,skill)
>   staff_xxxx (table) - name,x,y,z            (columns)  ---   foreign
> key(name) references staff_skills(name).
>   how to do the above?

You can't. If any occurrence of e.g. "John" in staff_skills refers to
the same person then you should have a separate "person" table to hold
their details.

Your staff_xxx tables can then reference table "person".

--
   Richard Huxton
   Archonet Ltd

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

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: doubt
Следующее
От: Duane Lee - EGOVX
Дата:
Сообщение: Re: Keep history of modifications