A Wishlist That Cleans Itself
MediumDescription
Create wishlist with customer_id (a whole number), product_id (a whole number)
and added_on (a date, required), where:
- a customer can save a product only once, so the pair
customer_id,product_idis the primary key customer_idmust be a real customer, and a customer's wishlist rows are deleted with the customerproduct_idmust be a real product
Add these rows:
| customer_id | product_id | added_on |
|---|---|---|
| 26 | 4 | 2025-10-01 |
| 26 | 9 | 2025-10-02 |
| 27 | 4 | 2025-10-03 |
| 28 | 12 | 2025-10-05 |
Then delete customer 26, and show customer_id, product_id and added_on of every wishlist
row.
End your query with ORDER BY customer_id, product_id.
Tables
| customers |
|---|
| customer_id (PK) |
| full_name |
| products |
|---|
| product_id (PK) |
| product_name |