Cheapest purchased product per user
Cheapest purchased product per user
In sales(id, user_id, product, amount, ts), for each user_id find the product with the lowest purchase amount and that minimal amount. Return columns user_id, cheapest_product, min_amount, ordered by user_id ascending.
Expected output sample
| user_id | cheapest_product | min_amount |
|---|---|---|
| 10 | Mouse | 25.00 |
| 20 | Cable | 10.00 |
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign inFocus radio
Paused · SomaFM · Fluid