473,405 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

[DB Design] Sometimes-Tracked Stock

Hi, my question is about database design. I'm trying to design a database for a stock control program as part of a larger system. The problem I am having is that some items in the database have individual serial codes, and others don't (all items have a barcode to indicate which item is it).

I've simplified the details here, but here's what the item table might look like if no items had individual serial numbers:

Expand|Select|Wrap|Line Numbers
  1. Items
  2. -----
  3. Barcode [PK]
  4. Description
  5. CurrentStock
  6. MinimumStock
  7.  
  8. AssignedStock
  9. -------------
  10. JobNo [PK]
  11. ItemBarcode [PK] [FK]
  12. QuantityAssigned
And here's what it might look like if they all had serial numbers:

Expand|Select|Wrap|Line Numbers
  1. Items
  2. -----
  3. Barcode [PK]
  4. Description
  5. MinimumStock
  6.  
  7. Serials
  8. -------
  9. SerialNo [PK]
  10. ItemBarcode [FK]
  11.  
  12. AssignedStock
  13. -------------
  14. ItemSerialNo [PK] [FK]
  15. JobNo
Notice absense of CurrentStock in Items, as this could be computed, also, quantity of a particular item assigned to a particular job could also be computed

My problem is that while some items are individually tracked with serial numbers others are not, just a note of quanities is used. I can't figure out a comprimise between the designs which allows for this.

Here is a design I'm thinking of:

Expand|Select|Wrap|Line Numbers
  1. Items
  2. -----
  3. Barcode [PK]
  4. Description
  5. CurrentStock {this might not match result of querying on Serials/AssignedStock}
  6. MinimumStock
  7. HasSerialNo
  8.  
  9. Serials
  10. -------
  11. SerialNo [PK]
  12. ItemBarcode [FK] {where HasSerialNo = true}
  13.  
  14. AssignedStock
  15. -------------
  16. JobNo [PK]
  17. ItemBarcode [PK] [FK]
  18. ItemSerialNo [FK] {null if HasSerialNo = false}
  19. QuantityAssigned {1 if HasSerialNo = true}
Unfortunatly this has several dangers to data integrity and consistancy. Can someone please point me in the right direction with this design? Thanks.
Oct 27 '08 #1
0 1244

Sign in to post your reply or Sign up for a free account.

Similar topics

98
by: Pamel | last post by:
I know this must have been asked elsewhere, but I cannot find it. There is a piece of text on my web page that I don't want browsers to resize. IE won't resize it if I specify the size in px, but...
8
by: Ash | last post by:
Hello all, I am hoping this is the appropriate newsgroup for a C++ interface design question. I am trying to design an interface for a subscriber to register/deregister handlers for various...
6
by: Jacek Dziedzic | last post by:
Hello! First of all please forgive me for not posting a compilable snippet, but rather a simplified piece of code with the unimportant details left out. Let's say I have two classes...
25
by: John Morgan | last post by:
Though I have designed and implemented a number of large reasonably well received web sites I do not consider myself a graphics designer I am now for the first time going to work with a ...
0
by: thivi | last post by:
hi all i am developing an user control in which i am creating a set of menu objects in a panel.. i have overriden the oncontroladded and painting. whenever i add the menu object i add it to the...
1
by: R Reyes | last post by:
Hello All, I'm always looking for ways to improve my code. Most of the time (whenever I'm working on a project) I write a bunch of functions. Then after the project is finished, I put all the...
4
by: Nathan Sokalski | last post by:
When editing an ASP Table, Visual Studio does not allow me to edit it in Design View. This makes it harder to add elements, because I must add every element either by using Design View to create...
12
by: FluffyCat | last post by:
New on November 28, 2005 for www.FluffyCat.com PHP 5 Design Pattern Examples - the Visitor Pattern. In the Visitor pattern, one class calls a function in another class and passes an instance of...
5
by: rdemyan via AccessMonster.com | last post by:
I have a need to add another field to all of my tables (over 150). Not data, but an actual field. Can I code this somehow. So the code presumabley would loop through all the tables, open each...
6
by: csharpula csharp | last post by:
Hello, I am building multi platform application and I would like to ask are there any links which would provide me code with factory design pattern implementaion in c# for this? Thanks! ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.