Chapter 5 · JOINs
74. Customers Who Reviewed Their Purchases
Hard40 XPE-Commerce
The data quality team wants to verify that reviews come from actual buyers. Find all reviews where the reviewer actually purchased the product. Return the customer's full name, product name, rating, and order_date, sorted by customer name, then product name. A customer purchased a product if they have an order containing that product in order_items.
Tables
- PKidINT
- first_nameTEXT
- last_nameTEXT
- emailTEXT
- phoneTEXT
- cityTEXT
- stateTEXT
- countryTEXT
- created_atTIMESTAMP
- PKidINT
- nameTEXT
- FKcategory_id→ categories.idINT
- priceREAL
- costREAL
- stock_quantityINT
- created_atTIMESTAMP
- PKidINT
- FKcustomer_id→ customers.idINT
- order_dateTEXT
- statusTEXT
- total_amountREAL
- PKidINT
- FKorder_id→ orders.idINT
- FKproduct_id→ products.idINT
- quantityINT
- unit_priceREAL
- discountREAL
- PKidINT
- FKproduct_id→ products.idINT
- FKcustomer_id→ customers.idINT
- ratingINT
- commentTEXT
- review_dateTEXT
Need help?
Ask Sol
AI tutor — looks at your current query and nudges you, without spoiling the answer.
Solution
Try the hints first — solving it yourself is what makes it stick.