RMires said:
I have a question on normalizing tables that has come up several times. As an
example:
If I have ten pieces of equipment with ten guages and I want to record the
data on the gauges every day, should I create one table with 100 fields:
*gack* Definately not. You should rarely need more than 25-30 fields (at
most with a few exceptions)
equip1gauge1 equip1gauge2
day1
day2
or 10 tables with 10 fields:
I wouldn't do this either. You need to think in even smaller terms for
your normalization.
tblEquip1
gauge1 gauge2 gauge 3
day1 day2
Is there a standard for this or does it just depend on the application?
Your normalized table would be 1 table, with 4 fields.
Table: tblGaugeReading
Fields:
ReadingID (an autonumber to uniquely identify every reading)
EquipmentID (a long, which has a relationship to your Equipment table)
GaugeID (a long, which has a relationship to your Gauge Table)
Reading (the actually reading value, either a string, long, int, whatever).
(Additionally, add things like ReadingDate, EmployeeID [who read it])
Alternately, GaugeID could just store the gauge number itself, and not
be linked to another table. But if you had a Gauge table, you'd be able
to define the kind of gauge it is, or whatever additional information
you needed. If you don't need it, don't store it.
This way, every Equipment has one record in the record table, and every
reading has one record in the reading table. If you did it your way,
you'd wind up with a lot of blanks for equipment that doesn't have 10
gauges. Even *if* every piece of equipment has 10 gauges, you should
consider single field storage like this