Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Our DBA is on medical leave, I am just a developer trying to do my part. Initially, the bean counters were going to use quickbooks. However, after seeing how much time they could save with custom development they have creeped my scope.

Rather than having a quantity of a particular type of shoe in a given size (ShoeInventory.Quantity) each individual pair of shoes needs to be accounted for and thus be given an Id, LeatherCost, ManufacturingCost, InventoryCost and TotalCost.

My question: Is there any foreseeable problem if I just move LeatherCost, ManufacturingCost, InventoryCost and TotalCost from the Shoe table to the ShoeInventory table?

When an order of shoes arrives from a ShoeOrder I will then just add a record to ShoeInventory for each pair ordered rather than updating a quantity?

I have no reason to think that this is a bad idea but it seems to easy to actually be the right answer. enter image description here

share|improve this question
add comment

1 Answer 1

If you move these additional costs to ShoeInventory then they will be associated with your ShoeInventory entity. This entity also has a relationship with ShoeSize. If I understand your schema (and I might not, so correct me if I'm wrong), the implication of this is that different sizes for the same shoe type could potentially have different sub-costs. This might give you extra flexibility, or it might make things more complicated. If you want to separate this data from shoes and don't want it attached to any other table (in case it doesn't make sense), you could create a shoeCost table:

shoeCost
---------
  id (PK)
  shoe_id (FK to shoe.shoeId)
  leather_cost
  manufacturing_cost
  inventory_cost
  total_cost (this could be a computed column of
              leather_cost + manufacturing_cost + inventory_cost,
              if it makes sense to do that)

share|improve this answer
    
Since each individual pair of shoes would have sub costs... I could just add Size as a field. Accounting for the cost of each individual shoe is going to cause a lot of redundancy anyway so I don't think I need to have a table with composite key to to just to count quantity? –  stink Feb 10 at 20:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.