product_reviews table

The product_reviews table in the E-commerce Database Schema schema has 8 columns, keyed by id, with 2 foreign keys to products and customers.

One review per customer per product. rating is constrained to 1-5 by a check constraint.

Columns (8)

Columns of the product_reviews table
ColumnTypeConstraintsDescription
iduuidprimary key
product_iduuidnot null, references products.id
customer_iduuidnot null, references customers.id
ratingsmallintnot null
titlevarchar(160)
bodytext
statusreview_statusnot null
created_attimestamptznot null

Indexes (2)

  • (product_id, status)
  • (product_id, customer_id) unique

Relationships