I have table A and B which cannot be edited and both using composite primary keys (region_id, number).
I have N tables, so called Information, each has its own ID as primary key.
A(or B) <-> Info Tables are M:N relationship and I need such a table.
So I designed a table CtoInfo
(where C is either A or B) with these columns
CREATE TABLE CtoInfo (
region_id ..
c_number ..
c_type // either A or B
info_id
info_type
.. //some other columns
)
first 3 columns identify A or B, other 2 columns, the info. (type says which table and id is the PK)
Now I want to make a Primary key on this table. But it looks like I need to include 5 columns in that PK constraint !?