Sign in to follow this  

[web] Need a second opinion on my tables

This topic is 3286 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.)

Share this post


Link to post
Share on other sites

This topic is 3286 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this