![]() ![]() ![]() If a mediocre design can be helped with a band-aid, surgery might be avoided. On the other hand, putting a UNIQUE constraint on Customer.SSN, and adding a FK on Claim.SSN, could provide referential integrity, with little or no impact on the applications.ĭon't get me wrong, I'm all for normalization, but sometimes pragmatism wins over idealism. It should be obvious that ripping out Claim.SSN and putting in a real PK-FK relationship would be ideal, but would also be a significant overhaul. The design is flawed, but has been in use for several years, and three different applications have been built on the schema. ![]() However, we don't live in an ideal world, and sometimes even a "small" change to a schema can have significant ripple effects to the application logic.Ĭonsider the case of a Customer table with a SSN column (and a dumb primary key), and a Claim table that also contains a SSN column (populated by business logic from the Customer data, but no FK exists). As others have pointed out, ideally, the foreign key would be created as a reference to a primary key (usually an IDENTITY column). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |