Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Primary key
Message
De
19/03/2003 10:04:45
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
19/03/2003 09:47:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00766466
Message ID:
00767552
Vues:
26
>Hi,
>Hmm.. Is it the way?
>
>I have item, outlet, outletitem and stockin, stockindetails table.
>
>
>Table: item
>Field: ItemID (PK), ItemCode, ItemName ....
>
>Table: Outlet
>Field: OutletID (PK), OutletCode, OutletDesc
>
>Table: OutletItem
>Field: OutletItemID (PK), OutletID, ItemID, CPU, PPU ...
>
>Table: StockIn
>Field: StockInID, InvoiceNo, InvDate, ....
>
>Table: StockinDetails
>Field: StockInID, StockInQty, StockInCPU ....
>
>
>
>In my app, I allow user to stockin for multiple outlet in ONE sotckin transaction. Then, what is the foreign key for the item+outlet of stockindetails table? Should I just use OutletItemID or composite key or.. ??

The PK in one table becomes the FK in other tables that reference it. So, yes, you should use the OutletItemId. This will make your FK small (4 bytes), and this is precisely one of the advantages of this method.

>BTW, is it the way using auto generated value as PK?

I suppose you mean "what is the way to do this".

Use function SerialNumber(), which I pasted in Re: Codigo character mas secuencia numerica Thread #767447 Message #767471. The message is in Spanish, but the function has comments in English.

HTH,

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform