View Full Version : best table design


travisdh
11-02-2010, 10:22 PM
Hi All.

I was after some advice on best designing the table structure for a database I am working on for work. We are a laboratory who do lots of different types of tests but the one I am focusing on is emissions testing at the moment.

I have the Job Details table set, but the problem i have is that we test a range of samples and this is where making the sample table easy gets harder.

For each job, there is a choice of really two cases, either it is an external quality testing, which means that the samples we log into the system and give a sampleID are tested, and i need to record flow rates and sampling times in another table, and then in a third table (which can't be changed) there is the result from the instrument that measures the samples.

The other case is where we test a product, this is logged into the system and the surface area, chamber it goes into, start time and finish time are all recorded, but then we log in anywhere from 1 to 4 samples which are directly related to this 'parent sample' which then get analysed using the instrument and the results for these samples show up in the third table, but then i need to use the flow rate for each of the child samples, plus the information from the parent samples which is normally sampling time, chamber, surface area

YNWA
11-04-2010, 07:04 AM
Hi All.

I was after some advice on best designing the table structure for a database I am working on for work. We are a laboratory who do lots of different types of tests but the one I am focusing on is emissions testing at the moment.

I have the Job Details table set, but the problem i have is that we test a range of samples and this is where making the sample table easy gets harder.

For each job, there is a choice of really two cases, either it is an external quality testing, which means that the samples we log into the system and give a sampleID are tested, and i need to record flow rates and sampling times in another table, and then in a third table (which can't be changed) there is the result from the instrument that measures the samples.

The other case is where we test a product, this is logged into the system and the surface area, chamber it goes into, start time and finish time are all recorded, but then we log in anywhere from 1 to 4 samples which are directly related to this 'parent sample' which then get analysed using the instrument and the results for these samples show up in the third table, but then i need to use the flow rate for each of the child samples, plus the information from the parent samples which is normally sampling time, chamber, surface area

Could you not just have the job table with fields.
jobID, date?, time?

THen a Parentsamples table with fields
sampleID (PK), jobID (FK), casetype, flowrate, timestart, timeend

Then in childSamples table with fields
childID (PK), sampleID (FK), starttime, endtime, surfacearea, chamber

Something like that.