Re: Primary and Foreign Key?

Поиск
Список
Период
Сортировка
Искать
От
Wayne Unruh
Тема
Re: Primary and Foreign Key?
Дата
Msg-id
BAY106-F12E52354080C494806E050AF890@phx.gbl
Ответ на
Список
Дерево обсуждения
Primary and Foreign Key? "A. Banks" <abanks@insightbb.com>
Re: Primary and Foreign Key? Oliver Elphick <olly@lfix.co.uk>
Re: Primary and Foreign Key? "Wayne Unruh" <waynepunruh@hotmail.com>
In relational databases  A table can have at most one primary key.  However, 
you are not required to have a primary key, so I would just have the two 
foreign keys in the table PEOPLEGROUPS.

For more information on Constraints see
http://www.postgresql.org/docs/8.0/interactive/ddl-constraints.html

Wayne Unruh

From : 	A. Banks 
Sent : 	Wednesday, September 21, 2005 8:46 PM
To : 	
Subject : 	[NOVICE] Primary and Foreign Key?



I have the following related tables:

PEOPLE
--------------
peopleid pkey,
name,
etc


GROUPS
-------------
groupid pkey,
description,
etc


PEOPLEGROUPS
-------------------
peopleid pkey/fkey,
groupid pkey/fkey


What is the CORRECT way (in Postgres) to define the PEOPLEGROUPS table so
that it has both the double primary key AND still acts as a foreign key for
people.peopleid and groups.groupid? Can i specify both or is this not
necessary? Any suggestions would be appreciated.

Thanks!


В списке pgsql-novice по дате отправления
От: Lane Van Ingen
Дата:
Сообщение: Re: Init script
От: Oliver Elphick
Дата:
Сообщение: Re: Primary and Foreign Key?
FAQ