composite primary key vs. primary key on additional single column
Date: Sun, 22 Mar 2009 14:05:53 -0700 (PDT)
we have 2 tables: individuals1 with primary key on ind1_id (numeric field) and individuals2 on ind2_id (varchar2 field)
individuals1 has as well ind2_id populated for some rows (not all) individuals2 has as well ind1_id populated for some rows (not all) both tables have common attributes e.g. first_name, last_name
As a requirement I need to have a new table (combined_inds) with all
the data from individuals1 and from individuals2 which will look like
[ind1_id, ind2_id, first_name, last_name] this structure will have many NULLs in both ind1_id and many NULLs in ind2_id, but at least one non-NULL value for these attributes for every row.
now I would like to create a primary key on that new table.
Is it better to have a composite primary key on both ind1_id, ind2_id? or maybe it's better to populate a new column that would hold concatenation of both of those columns, and then do the primary_key constraint on that?
chris Received on Sun Mar 22 2009 - 16:05:53 CDT