Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Begin Transaction
Message
 
 
À
29/09/2016 06:02:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows 7
Network:
Windows XP
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01641395
Message ID:
01641482
Vues:
33
>>>>Code column seems to identify the product, I think it can be used as PK.
>>>
>>>A sales invoice might have product codes more than once.
>>>So code column can not be used as primary key.
>>
>>So, what is the key - the invoice_no, product code + date ?
>
>I think no,
>Please imagine what will be the primary key if table has data like this
>
>vou_no--code---Product---qty---rate--Amount
>---1-------1401----Apple------10----15----150
>---1-------1402----mango-----20----15----300
>---1-------1401----Apple------10----12----120
>---1-------1401----Apple------12----16----180
>---1-------1402----mango-----20----13----260
>
>code 1401 was used 3 times due to different rates
>code 1402 was used 2 times due to different rates
>
>In this situation, is there any chance to create ID?

Sounds like vou_no, code and Rate are the PK. Alternatively we can just add auto-increment identity column to be a PK and the combination of vou_no, code, Rate will be unique index.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform