Subject Re: [firebird-support] Primary keys - was Copy records
Author Lester Caine
Planles wrote:

> Table1:
> M_id, M_desc, M_desc2,...

So M_ID is Unique PRIMARY_KEY = M_id

> Table2:
> MC_id, MC_key, MC_qty,...
> Each record in Table1 can have multiply records in Table2.

So MC_key may not be unique?
But MC_id + MC_key is unique ? ( Different MS_id's could have the same
MC_key ? )

> Now I had M_id in Table1 as primary key, and MC_id and MC_key from Table2 as
> primary key. MC_id is equal to M_id, and MC_id and MC_key is a unique pair.
> Could you explain me, how should I proper do this relationship.

Table2 PRIMARY_KEY = ( MC_id, MC_key )

I have records in master table 1 to n
and sub records in detail table 1(1 to n)
so the the detail table uses record and subrecord to create a primary
key. All details will have a sub record of 1, but only one for each
master record.
Hope that covers it ;)

Lester Caine
L.S.Caine Electronic Services