Undo a Wrong Delete
MediumDescription
Customer 25 asked to remove their review of product 25. Write the moderator's session, in this order:
- In a transaction, delete every review written by customer 25. That was a mistake: undo the whole transaction.
- In a new transaction, delete only customer 25's review of product 25, set product 25's
ratingto NULL, and commit.
Then show product_id, rating and reviews (the number of reviews the product still has)
for products 24 and 25.
End your query with ORDER BY product_id.
Tables
| reviews |
|---|
| review_id (PK) |
| product_id (FK) |
| customer_id (FK) |
| rating |
| comment |
| created_at |
| products |
|---|
| product_id (PK) |
| product_name |
| rating |