[web] Need a second opinion on my tables

Started by
1 comment, last by johan123 15 years, 4 months ago
Let's say there is chair company that wants to keep track of repairs they make on chairs. Product Info Serial_Number * Chair_Type Branch_code Service_date Repairs Serial_Number* Date_received* Date_sent Fault_code Repairs_and_comments Employee_ID The fields I picked as primary keys have stars. Now, in the second table do you think it's okay to have primary keys in this way (as a superkey)? Secondly if I do use this superkey, I'm a bit confused as to whether I should do a one-to-many relationship (Product Info - Serial_Number, Repairs - Serial Number)... ... or a one-to-one relationship (Product Info - Serial_Number, Repairs - Serial Number, Date_received). I think this is the better option but MS Access doesn't let me do a one-to-one like this because there aren't an equal number of primary keys! Thanks
Advertisement
The choice for your superkey in the repairs table is perfectly fine if the same chair cannot be repaired more than once on a given day. I highly doubt that a company could repair a chair, send it back to the customer and have the customer send it back for repair in a 24 hour period.

You need a one-to-many relationship between the product info table and the repairs table because a chair can be repaired more than once. A one-to-one relationship isn't allowed because both tables require the same primary key.

One-to-one relationships are typically used in tables that store sparse data, in order to keep the size of the main table down. They are also used in table designs where the tables are highly normalized (e.g. splitting one table into multiple tables that simply the primary key and a single data column.)
thanks you again!

This topic is closed to new replies.

Advertisement