You have replicated factory name and site name in two places, combined sites and factories into one table, and combined first and last names in one field - these are examples of less than perfect normalization. What should be in the engineers table is the factory id, not the name. Sites should be one table, factories another, joined by having the site id as a FK (foreign key) in factories. This sort of thing will cause design problems which will only perpetuate, and probably get worse as you go. Each "thing" that can be considered to be its own entity should usually be in its own table. I recommend you read up on normalization as well. A more normalized set up based on your attachment would be as follows (note, this is not a complete overview, being limited to the 3 entities related to your post). Note also that while I've used the auto id's from your tables as foreign keys, you could substitute the value fields instead. Hopefully I have made the correct connections based on your data.
tblSites |
|
SiteID |
SiteName |
1 |
Barton |
2 |
Scunthorpe |
3 |
Howden |
tblFactory |
|
FactoryID |
SiteFk |
FactoryName |
1 |
1 |
Durham |
2 |
1 |
Lincolnshire |
3 |
1 |
York |
4 |
1 |
Kent |
5 |
1 |
Surrey |
6 |
1 |
Devon |
7 |
2 |
Factory 1 |
8 |
2 |
Factory 2 |
9 |
2 |
Factory 3 |
10 |
2 |
Factory 4 |
11 |
3 |
Factory 1 |
tblEngineers |
|
EngrID |
SiteFk |
FactoryFk |
2 |
2 |
8 |
3 |
2 |
8 |
4 |
2 |
7 |
5 |
1 |
1 |
6 |
1 |
1 |
7 |
2 |
8 |
You should also consider not having attachment fields as these can cause exponential db bloat. I think most developers would prefer these fields to contain links to folders if possible. I could probably come up with a solution to your problem, but if you're going to take the advice on normalization, that would make the solution useless.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.