I have a database table called as Receipt, as follows:
The columns
- payment
- invoice
- custom_field
- organization
being separate tables
The constraint is that for each receipt there cant be more than one of any from the above. Which means for each receipt there will be one payment entry, one invoice entry, one custom_field and organization entry.
Now I think that I can get rid of all the column names mentioned above and instead associate _id as the primary key for my receipt table and same _id as the foreign key for all other tables.
In the above structure I am also confused as to how should I generate unique values for - payment - invoice - custom_field - organization if I go with the above structure. However if I chose to go with the later the primary and foreign key will be auto generated and unique. I am also concerned about editing. Is there anything helpful you can suggest?
Below is my structure:
Aucun commentaire:
Enregistrer un commentaire