Customer and Product Relationship with Review – Database Design

database-designerd

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.

Best Answer

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.