I draw this ERD but I'm not sure if the relation in customer and product with review is correct. also, is it right that I made Rate, Date and time this way ?

enter image description here

this is my Description for review

Each customer can write as many reviews of the products he/she bought along with the date and time of posting the review. The review will carry a unique ID. Also the customer can give rating from 1 to 5 which are illustrated by showing glowing gold stars, and every review is welcomed and encouraged to be writing. So the website can be an open area to discuss the best option to buy. Also every customer can choose to writes as many reviews on the product or not.


Your relationships are correct, however, they would allow for a customer to have records of products they've never bought. Is this something you want? Otherwise, you'd be better off establishing the relation between Review and OrderDetails (the intermediate table for Order-Product which in your ERD doesn't have a name), rather than to Product directly. That being said, your ERD would probably be clearer if it'd be [Order]---*[OrderDetail]*---[Product], where OrderDetail includes quantity, price used, discount, special notes, etc.

Also, Rate should perhaps not be a separate entity, but rather be Review's attributes.

  • So, I should add another entity called OrderDetail.. And when I added Rate to separate entity I thought it should be recorded like quantity. it's wrong to make it in separate entity ?
    – Halah
    Apr 7 '16 at 13:34
  • In which cases rating would not be part of review? If users can rate without adding a review, then it is ok for it to be separate, but perhaps it introduces a complication. Perhaps it would be simpler and more elegant having a single table where review and rating are can be optional, but not both. Apr 7 '16 at 22:27
  • it's like amazon website, the customer can comment without rating the product.
    – Halah
    Apr 7 '16 at 22:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.