Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The right way
Message
From
24/09/2009 15:11:50
 
 
To
24/09/2009 15:06:53
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
01426003
Message ID:
01426006
Views:
96
Your friend is right. A primary key should have no other meaning than being that and should never be seen by the user. I would go further in recommanding that you add a primary key in your detail table (inv_detail_pk).

>what's the right table structures for one-to-many forms?
>
>eg. for invoicing, I use:
>
>invoice.dbf
>---------------
>inv_no
>inv_date
>cust_id
>
>inv_detail.dbf
>------------------
>inv_no -> foreign key of invoice.inv_no
>stock_id
>qty
>price
>
>while my friend insists the right way is:
>
>invoice.dbf
>---------------
>inv_pk
>inv_no
>inv_date
>cust_id
>
>inv_detail.dbf
>------------------
>inv_fk -> foreign key of invoice.inv_pk
>stock_id
>qty
>price
>
>in his opinion, the key shoud be meaningless, not represent anything.
>
>while my way (using invoice number) will cause lots of problem in the future, espesially with SQL databases.
Previous
Reply
Map
View

Click here to load this message in the networking platform