Reputation: 3864
For a project I am required to create a system which allows sales of items, basically an EPOS system. I have it mostly working but I cannot think of a good way in which to store transactions.
As a transactions would have one or more items, and I need to know what the items are how would I store this in the transactions table? Can I have CSV within a field in the table to store more than one product ID?
transactionID
noItems
itemID <- Store more than one?
cost
Any suggestions?
thanks
Upvotes: 1
Views: 1496
Reputation: 85056
Try something like this:
Transactions
-------
TransactionId
TotalCost
TransactionItems
-----------
transactionId
ItemId
Items
-----------
ItemId
ItemName
Price
Do NOT store multiple values in a single field. This will make your database world a living hell.
Upvotes: 1