• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 476
  • Last Modified:

Database Normalization

I'm setting up a new database with the following types of orders

Purchase Orders (sent to manufacturer for inventory)
Sales Orders (received from customers)

The manufacturers will get reports of when/where their items are sold but I don't understand how I'll connect the two for reporting purposes

If I order 5 widgets for inventory at different costs over time - and 3 are sold - how do I know which widget went where....

Currently I have a field "SO_ID" on every "PO_ID" - and a "PO_ID" field on every "SO_ID" so when an item is picked and the serial number is captured they sync-up - but it just doesn't seem like the best way to do this.  It seems like the way I do it now has repeated data and that's what normalization tries to avoid.




0
ProdigyOne2k
Asked:
ProdigyOne2k
  • 2
1 Solution
 
johanntagleCommented:
Think you should have a third table for inventories, which will contain both po_id and so_id.  Each widget will have a row on the table and will also act as the join table between purchases and sales.
0
 
ProdigyOne2kAuthor Commented:
Ok

Now when trying to re-do our database I'm trying to follow all of the "rules" I'm reading about...and something I read was that no column should be "null".  Maybe this isn't a *must* - but just wanted to check that out as well

Of course the inventory will have a PO_ID right away - but the SO_ID would be "null" until it was committed to an order - is that a concern having a "null" SO_ID?
0
 
johanntagleCommented:
I don't know where you read that -> it's generally okay for a column to have null values unless it is the primary key.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now