I'll leave it to Kevin E. Ford to describe today's WTF:
So there I was (no sh!t) innocently evaluating an off-brand accounting package. One of the things I wanted to look at was the table structure. Right off the bat I noticed that there was no referential integrity constraints, strange but I can live with it.
I then go to open the Companies table. I find that the following three fields make up the primary key:
CompanyId nVarChar 36 Disallow Nulls
DivisionId nVarChar 36 Disallow Nulls
DepartmentId nVarChar 36 Disallow NullsOk, maybe I misunderstood the relationship between the Companies table, the Departments table and the Divisions table. Fair enough, I then opened up the Departments table to find the following fields comprising the primary key:
CompanyId nVarChar 36 Disallow Nulls
DivisionId nVarChar 36 Disallow Nulls
DepartmentId nVarChar 36 Disallow NullsThen the Divisions table:
CompanyId nVarChar 36 Disallow Nulls
DivisionId nVarChar 36 Disallow Nulls
DepartmentId nVarChar 36 Disallow NullsI think I now understand why there were no referential integrity constraints, can you say deadlock? Also since all three tables really have the same keys, they are all on the same logical level. You might as well just have put all the fields in the same table with a single ID. Needless to say this was the last straw for my evaluation.