Results 1 to 2 of 2
Thread: Setting up a database (97)
2003-05-29, 14:52 #1
- Join Date
- Feb 2003
- Thanked 0 Times in 0 Posts
Setting up a database (97)
Can anyone help me with the best way to set up a simple database? I have sets of information. The first is Classes, which includes 11 different classes offered and the only info we want to track is Class Date, Class Time and Total Participants for each class. The second table is Equipment - a list of 8 pieces of equipment and Date and Total Participants (how many used that piece of equipment for that day) for each date.
My question is, should each Class have it's own table because there will be tons of entries for each Class. There could be 5 classes per day, so it would be same date but 5 different times for that day and then total participants for each different time. Same thing with the equipment. And can the Classes and Equip info somehow be together or should it be completely separate?
Any help would be appreciated.
2003-05-29, 17:18 #2
- Join Date
- Mar 2002
- Thanked 29 Times in 29 Posts
Re: Setting up a database (97)
I think you need two tables for the classes:
<UL><LI>A table containing a unique class identifier ClassID (for example an AutoNumber field), plus fixed class information, such as the Subject, and other info that is not dependent on the date and time. This table will contain only one record for each class. ClassID is the primary key.
<LI>A table containing ClassID plus Class Date, Class Time, Total Participants and other information that depends on the date and time. This table will contain multiple records for each class: each date/time combination has its own record. ClassID is not an AutoNumber field in this table, but Numeric (Long Integer). It might be a good idea to include an AutoNumber field in this table too, but it shouldn't be named ClassID.[/list]You should create a relationship between the tables on the ClassID field; set referential integrity for the relationship. This ensures that you can't add records to the second table for classes that haven't been created in the first table.
You will need two tables for Equipment too. The first table will be similar to that for Classes: a unique identifier EquipmentID plus "fixed" information. How to set up the second one depends on what relationship there should be between equipment and classes, if any. If there is no relationship, set up the second table like the one for classes. If the equipment is to be used in classes, you'll have to tie it to the second table for classes.