> 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.