RE: Primary Keys vs Unique Index
Posted in 2000
Topics: Triggers, Constraints & Referential Integrity
For me it is SOP to make something a primary key if it has all the attributes of a primary key. It makes for good documentation, as well as being there if you ever decide to add referential integrity.(Though I am pretty close to positive you can add RI and reference a unique key....) I just dont see any disadvantages for having a primary key, so call it what it is .... Will >===== Original Message From gps@lucent.com ===== >Thanks for the replies > >I am referring to unique indexes where no referential constraints/foreign keys >are involved. There are instances where primary/foreign keys exist in this >database and I understand the relationship there. The person that setup this >database used primary keys instead of unique indexes even where there were no >foreign keys/constraints involved. Is this now just considered standard? > >Steven Hauser wrote: > >> Primary keys will allow you to enforce referential integrity. >> a foriegn key needs a primary key to refer to. Referential constraints >> are sometimes very important. >> >> If referential integrity of data is not an issue then maybe you would not use >> primary keys. >> -- >> --------------------------------------------------------- >> Steven Hauser >> email: hause011@tc.umn.edu URL: http://www.tc.umn.edu/~hause011 >> --------------------------------------------------------- ------------------------------------------------------------ This e-mail has been sent to you courtesy of OperaMail, as a free service from Opera Software, makers of the award-winning Web Browser, Opera. Visit us at http://www.opera.com/ or our portal at: http://www.myopera.com/ Your free e-mail account is waiting at: http://www.operamail.com/ ------------------------------------------------------------
William Rice wrote: > > For me it is SOP to make something a primary key if it has all the attributes > of a primary key. It makes for good documentation, as well as being there > if you ever decide to add referential integrity.(Though I am pretty close to > positive you can add RI and reference a unique key....) I believe that a Foreign Key Constraint has to refer to either a Primary Key Constraint or a Unique Key Constraint, I do not think that just a Unique Index is sufficient. For Gregory, there is no significant cost to using PK or UK constraints but I go with the recommendation to create the unique index independent of the constraint just for naming and reorganization simplicity later. The constraints will use the existing index you create as long as it matches the constraint key. Art S. Kagel > I just dont see any disadvantages for having a primary key, so call it what it > is .... > > Will > >===== Original Message From gps@lucent.com ===== > >Thanks for the replies > > > >I am referring to unique indexes where no referential constraints/foreign > keys > >are involved. There are instances where primary/foreign keys exist in this > >database and I understand the relationship there. The person that setup this > >database used primary keys instead of unique indexes even where there were no > >foreign keys/constraints involved. Is this now just considered standard? > > > >Steven Hauser wrote: > > > >> Primary keys will allow you to enforce referential integrity. > >> a foriegn key needs a primary key to refer to. Referential constraints > >> are sometimes very important. > >> > >> If referential integrity of data is not an issue then maybe you would not > use > >> primary keys. Art S. Kagel