Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Theoretical issue - how do you handle this?
Message
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01001223
Message ID:
01001517
Views:
15
Nadya,

Just to put a concrete example together for lurkers:
LookupId  LookupType  LookupValue
1         Color       Red
2         Color       Green
3         Color       Blue
4         Flavor      Sweet
5         Flavor      Sour
If you have a table that has a column for the item's color and it's FK constrained only on table.ColorNo = Loopup.LookupId then it would be possible for an item to have a color of "Sour".

The FK constraint needs to have the LookupType included in the constraint so that only the Color rows are valid ColorNo values.

>>FK constraints on lookups are every bit as critical. If you use a single overloaded lookup table you need to ensure that you constrain the lookuptype for a given FK into the lookup.
>>
>>>In this question I was more concerned about lookup tables. Of course, for real parent and child we must have triggers in place. I do agree with having them for lookup as well, but want to find out the general practice.
>
>That was originally implemented with very fanky indexes. We changed the indexes, but left the constrains. So, you're right, they don't make much sense now!
>
>Thanks for helping me in realizing that.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform