No, PAVB is busy trying to boost his ego by criticizing me...
Anyone that has anything constructive to add is welcome to join in!
citldba, I have had a few other people say that using a Super-Type/Sub-Type approach would be reasonable and is a good way to avoid having a "wide" table with lots of Nulls.
I also think it encourages keeping "Apples with Apples" and "Unleaded with Unleaded"!!
Attached is an ERD I created yesterday. It is far from complete, and does not show everything, but is a good sample of what - I believe - we were discussing...
Yes, that looks like the sort of thing we have been talking about
Okay, good!
Is there a need for each Sub-Type Table (e.g. Telephone) to have its own PK (e.g. "TelephoneID") plus a FK (e.g. "ExpenseID") to link back to the Super-Type Table (i.e. Expense), or is it okay to just have one ID field that is both a PK and FK?
I'm not quite sure what you mean. If you don't have a sub-type id (e.g TelephoneID) then you are restricted to 1 record in each sub table per super type record (so only 1 Telephone record per expense).
If that is what you want then you don't need to sub-type keys
So Bob, what happened with all your sabre-rattling arguments about...
Originally Posted by Bob Just
... I know lots of people - Oracle included - who would disagree.
From a datatype standpoint alone, I disagree.
You don't buy 10.57 bananas!
"ItemQuantity" is an Integer. "TotalGallons" is a Real number. As such, they aren't logically the same thing.
?
I can see a single "Quantity" field in the last version of your documentation. Are you going against your own convictions and the opinion of "lots of people -Oracle included" just to make me happy? that's very brave indeed.
You know what... you are welcome! Oops... you forgot to say "thank you"
Today is your lucky day Bob, here is a hint. In your current design -which in any way means I'm endorsing it - your sub-type tables should have a one-to-one relationship with your ExpenseDetail table, not a one-to-many with Expense table; it just doesn't work. I'm telling you this just because it hurt my eyes.
Now you are free to say whatever you want -that's immaterial - you already know sooner or later you will have to revise it and do what I'm suggesting.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.