Jump to content

Archived

This topic is now archived and is closed to further replies.

gnuffo1

Which of these database designs is the best?

Recommended Posts

The website in planning will have a system for rating and writing reviews on products. Since there will be a lot users that will leave the review field blank, which of these designs is the best:

1. Have two seperate review and ratings tables and when a user does fill out both a one to one relationship between the two records is established. That way records in the review table (or even the rating table is user only write reviews and don't rate) will only be created when there is actually a review.

2. Have one table that contains a review field and the ratings fields. This version will have a lot of NULL (empty) fields, but should be quicker.

Note that the ratings and the reviews are both for the product, the ratings are not ratings of the review or vice versa.

Share this post


Link to post
Share on other sites
I think you should go with the former -- if you ever need to store more than a single field about the rating (which you will), then it makes sense to have a separate table. Of course, the FK would be in the ratings table pointing back to the review, not vice versa, or you'd end up with the same problem.

Hope that helps.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.