Order count per user

Order count per user

From sales(id, user_id, product, amount, ts) count how many order rows belong to each user. Group by user_id and return columns user_id and orders (number of rows). Order by user_id ascending.

Expected output sample

user_idorders
104
203
PostgreSQLv16

Your query result will appear here

Focus radio
Paused · SomaFM · Fluid