If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Trouble with Correct vs Usable Design

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-06-10, 14:19
Eva Mendes Eva Mendes is offline
Registered User
 
Join Date: Jun 2010
Posts: 1
Trouble with Correct vs Usable Design

Hi guys,

I am having a bit of a trouble deciding what is the proper way to store a list of transactions. Is it possible to store transaction using only a relationship? I don't really see how, since if i had the same item sold twice by the same salesperson and same client that would create an impossible operation.

Say that i want to sell Pen model 1 by Salesperson 1 to Client 1. I would have

ClientID, ProdID, EmpID
1,1,1

Then that same person comes in the next day and buys another Pen model 1 from the same salesperson i would have

ClientID, ProdID, EmpID
1,1,1

Should i create a Transaction entity? That stores all records, or is my ProdID flawed to begin with since it uses the Same prodID independent of the instance of the Pen model?

i.e. Should I make each Item unique, even if its identical (like all pen model 1 instances have a unique ID), or should each transaction be unique?

Cheers,

Last edited by Eva Mendes; 06-06-10 at 14:23.
Reply With Quote
  #2 (permalink)  
Old 06-07-10, 01:36
EddyEn EddyEn is offline
Registered User
 
Join Date: Jun 2010
Posts: 1
EddyEn

A good database design give you no problem of inserting, updating and deleting with data integrity. if you need additional benefits from your database you will find out on DBMS programs.
To response your question on database design issue, you could consider a sold pen as a unique one if you have no returned good policy. That will make sense to have an ID for individual pen and to use it as primary key. Then uses Sale ID,Pin ID and Customer ID as secondary key to response thoes details when querying. You can also have data constraint to force secondary key fields not to be empty so that you can have links to thoes detail when you do a query.
Reply With Quote
  #3 (permalink)  
Old 06-07-10, 03:51
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
Ordinarily for transactional systems you will have an order header (the date of a transaction, client, salesperson etc.) and relate that to order detail (sometime order line) that contains the details of the items purchased (product id, discounts, quantity etc.).

So to answer your question, you decompose your table into two and the missing part of your key is the time of the sale.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On