hello again sir. I would assume that this attachment is the product of all that you've learned from the guru's here. Right?
There are a few fundamental things wrong with what you have, and it would be extremely beneficial for you to know them so you can build a product that looks good. Not trying to be a preacher, but I can help you out enough to straiten the track a little bit.
First of all, there is no hierarchy established with your data. Databases are pretty much all the same, with some exceptions, but most people can follow the same pattern for almost everything and produce a satisfactory result. Every db, if it's structured even close to correct, follows a hierarchy of somekind. The premise is the one-to-many relationship. Your project looks like you're keeping track of people and their work schedules. Not sure where that is going, but from the data you have now, a correct setup would look like this:
PEOPLE
- workername
- province
- address
- phone
- postcode
- city
- state
- notes
WORKHISTORY
- hours
- day
- month
- year
- payrate
- anything else
That's all that's needed really, just 2 tables, but other tables can be used, such as PAYCHECKS, to record periodic paycheck data.
Second, when you say "use as many tables as possible", that is not even close to correct. Whoever said that is completely wrong, especially if it said to a beginner, because beginners of any discipline have a tendency to take advice for what the words say, and that's it. As you can see in the above example I gave you, the number of tables I would need to do this same thing is half the number you have now.
The next thing you really need to change is your join types between the tables. Based on the number of posts I've seen from you this week, I would guess that join types are not that familiar to you, but I could be wrong. I won't mention the right joins and such that you have now, because they are not needed, and if you (heaven for bid) keep the structure that you have, they should be changed to inner joins anyway.
As far as using keys in every table, YES, in general every table that keeps data that is eventually going to be displayed to a user should have an autonumber field in it that identifies it. This is completely normal, and I personally do it in every table I ever create. The only exception to me personally, are lookup tables. An example of a lookup table would be discount rates for a retail store product. Whenever they are needed, they are looked up via code or queried. They never appear in records that come directly from a table.
With all of that said, the one thing I believe that will benefit you greatly is the hierarchy. If you know that, a lot of other things simply fall into place if you are familiar with the tools to make the hierarchial data effecient (like joins, relationships, keys, etc...). To give you a better understanding of the hierarchy, programming languages that use objects do the same thing. It's the same format. So do corporations.
- many workers to a team leader
- many team leaders to a departmental manager
- many departmental managers to a building
- many buildings to a regional manager
- many regional managers to a vice president
- many vice presidents to a CEO
and the examples go on and on and on. You can produce a structure that is, more than 99% of time, just fine, if you first identify the chain of command between your "objects", or "drivers". In your current database, the highest link of the chain of command is the worker. Thus, workers should be assigned to one table. There are many "pay periods/work periods" per worker. Thus, this is the next link in the chain, further down than the worker. And there you have a parent/child relationship. Every link is like this, and it goes on and on, until there are no more children "drivers" to deal with.
If that makes sense, than you've just gotten smarter.
Not by me of course, because I know nothing really, but IMO, hierarchies are everything. Without them, a db is impossible and a waste of time really.
This is off subject, but to give you a great example of this again, I just finished compiling my own vba system to get help with it faster, and the whole programming language is based on the same concept. For example, most of the vba that you see has this hierarchy:
Code:
LIBRARY FILE
OBJECT CLASS
METHOD
PARAMETER
DATA TYPE / ENUMERATION (for parameter)
PROPERTY
RETURN TYPE (for property)
See...Microsoft even started it!