Deviopath › PostgreSQL

Products per Category

Easy · Grouping

GROUP BY column puts rows with the same value into one group. An aggregate like COUNT(*) then works once per group instead of once for the whole table.

Return category and product_count (how many products are in that category), one row per category.

Next: Who Placed Each Order?