Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Table FK/PK question

WhatwasthatMay 26 2008 — edited May 26 2008
Hi,

I've been tasked to help improve a (smallish) "legacy" system developed by one of the IT companies around, and have a few queries on the way some tables have been set up:

1) If table doesn't have a primary key explicitly defined, ie the column has been defined as Unique, non null, and has an index is it worthwhile dropping those and declaring the column as the PK to the table? Or is it fine as it is?

2) If a table has a PK and an index on a column, if I drop the index I heard there is a possibility that the PK may then not have an index. Should I just leave the index there, or if not, how do I ensure the primary key has an index.

3) If the primary key to a table is a composite key, made up of two IDs from other tables, will I need to also define a foreign key for each column and an index for each column?

4) Is it such a big deal if a table doesn't have a primary key, e.g the foreign key column essentially acts as a defacto primary key.

Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 23 2008
Added on May 26 2008
3 comments
642 views