I am trying to take my database (currently Access 2000, soon to be MySQL 3.53, hopefully PostgreSQL once I get a grip on it) from the dark ages of weekend hacks to a solid, well-formed and normalized pile of data. Something I want to do is be able to perform some cost-analysis by taking revenue generated and subtracting payroll, truck cost, etc. This should get me to a day-by-day representation of income versus cost of doing business. Hopefully.
Anyway! I am considering having a "profit center" with daily entry per client at the top of my "food chain" in one table. Then each truck's daily run linked to that row in the "profit center" table. I'll also have another table with non-truck related payroll (warehouse hours, etc) linking each entry to the profit center table. Just a thought here, on to the question...
How far do you go to get extreme normalization? I am looking at the date for deliveries made, and getting that about 3 related tables down to payroll (does that make sense?). If the date is in the "profit center" row, and the truck's daily trip is related to that profit center record, do I put the date in the delivery record (3 related tables down) in order to make an easier query (that's 3 LEFT JOINs right?) to find out a day's payroll, do cost analysis, etc?
Sorry if this makes no sense. I'm not formally educated in this stuff, self-taught from help files and the internet at large (Tek-Tips being a big chunk of my learning!).
Ugh, previewed and couldn't make sense of it myself!
Hope that helps. See, inv_bill is "Complete, billing the client for" stuff. In order to generate an invoice for a date range, I'd have to do JOINs across 4 tables to get back to my original date. But having the same date repeated in multiple places is "just plain wrong" and should be avoided if possible.
So, where do you draw the line between normalizing, and the aggravation and overhead of getting all the details for your data?
----
JBR
Anyway! I am considering having a "profit center" with daily entry per client at the top of my "food chain" in one table. Then each truck's daily run linked to that row in the "profit center" table. I'll also have another table with non-truck related payroll (warehouse hours, etc) linking each entry to the profit center table. Just a thought here, on to the question...
How far do you go to get extreme normalization? I am looking at the date for deliveries made, and getting that about 3 related tables down to payroll (does that make sense?). If the date is in the "profit center" row, and the truck's daily trip is related to that profit center record, do I put the date in the delivery record (3 related tables down) in order to make an easier query (that's 3 LEFT JOINs right?) to find out a day's payroll, do cost analysis, etc?
Sorry if this makes no sense. I'm not formally educated in this stuff, self-taught from help files and the internet at large (Tek-Tips being a big chunk of my learning!).
Ugh, previewed and couldn't make sense of it myself!
Code:
ca_pcenter
ID, client, date
man_trips
ID, pcenter, truck, s_miles, e_miles
inv_stops
ID, trip, name, zip
inv_bill
ID, OID<inv_stops.ID>, client, type, fee
So, where do you draw the line between normalizing, and the aggravation and overhead of getting all the details for your data?
----
JBR