Views and purchases per product
Views and purchases per product
From the events table (columns product_id, event_type), count for each product_id the number of 'view' events and 'purchase' events. Return product_id, views, purchases. Sort by product_id ascending.
Expected output sample
| product_id | views | purchases |
|---|---|---|
| 1 | 2 | 1 |
| 2 | 2 | 1 |
| 3 | 3 | 1 |
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign inFocus radio
Paused · SomaFM · Fluid