From: | rsmogura(at)softperience(dot)pl |
---|---|
To: | "Miguel Vaz" <pagongski(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Table design - postgresql solution |
Date: | 2010-12-05 16:26:52 |
Message-ID: | 1e6057b14cec13858da1d374f9f1ec5c.squirrel@softperience.eu |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> Hi,
>
> I have a bit of a DB design question, associated with postgresql in
> particular, hopefully thinking it could solve my dilemma.
>
> This is my setup of 3 tables:
>
> Table_1
> id_t1
> name
> date_of_discovery
> history
>
> Table_2
> id_t2
> name
> type
> size
>
> Table_3
> id_t3
> name
> location
> color
>
> I want a solution (table or groups of tables) where i can establish
> relations between items of every table, for example:
>
> row with id=2 from Table_1 is connected to row with id=23 from Table_3
> id=9(from Table_2) is connected to id=83(from Table_1)
The common in many to many relations is to create for each two tables
"joining" table
tab1_tab2 with corresponding foreign keys to tab_1 and tab_2.
If you want make general relation table, to keep all relations try with
CHECK CONSTRAINT with own function inside.
From | Date | Subject | |
---|---|---|---|
Next Message | John R Pierce | 2010-12-05 19:32:31 | an enhancement idea |
Previous Message | Stefan Keller | 2010-12-05 13:43:50 | Re: One-click Installers for 9.1 Alpha 2 (ETA) |