Jump to content

Which of these database designs is the best?


gnuffo1

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.