Views and purchases per product

Back to lesson

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.

Row order matters

PostgreSQLv16

Your query result will appear here

Focus radio
Paused · SomaFM · Fluid