I am looking for clairification on a post I read here:
One field refers to fk field in more than one fk table
What I am trying to understand is quoted below where Pat does not recommend adding an inventory type to store a value in a master table, that identifies the item.
Quote:
|
Originally Posted by jfugiel
You could certainly add a inv_type field and store the value of 'server' or whatever to identify the individual inventory item. However, this still doesn't tell anyone (dba's or programmers) what values it is legal to put where. If you have a field called raid_configuration that should only contain a value if inv_type = 'server'... how would anyone else know that?,
|
Quote:
|
Originally Posted by pat phelan
While I would emphatically NOT recommend it, I have seen positively Machiavellian webs of constraints used to do exactly what you've described (if attribute A is blank, then attribute B must have a value; if attribute J has the value "S", then attribute Q must have a value in {1, 2, 5, 7} and so forth). I prefer to use entity decomposition (using a master table to store shared attributes and separate tables to store attributes specific to a sub-class) because in my mind that is a cleaner and simpler way to do things.
|
Can someone tell me in layman terms what Pat is getting at please?
I am understanding what "jfugiel" is describing to be what
I call a lookup table or lookup field that is specific to only that table. In the case of a parent table:
Code:
lookup_table
Id
permissable_field1
permissable_field2
permissable_field3
employee_table
employee_Id
Id
field1
field2
I actually have a pic I have included of one of these lookup tables.
I like to use these types of "lookup" tables for RI purposes. Sometime I have used a lookup field instaed as jfugeil stated. Is this what Pat is saying he would not recommend? The parent table or the field or both? Why is this not a good idea?
Sorry for my ignorance, I'm just trying to learn. Thanks
Frank