Category Restock Budget
Part of the SQL Foundations section of Coddy's PostgreSQL journey. Lesson 15 of 22.
Challenge
MediumFor active products only, return category, product_count and stock_value. Keep categories with at least two active products. stock_value is the sum of price times stock; order by category.
The input tables are shown in the test panel. Each run starts from fresh data. Return the named columns in the stated order; do not hard-code the displayed rows.
Try it yourself
-- Write your SQL here.
All lessons in SQL Foundations
3Summarize Rows
Count Rows and ValuesTotals and AveragesGroup by CategoryFilter Groups with HAVINGCategory Restock BudgetPractice on your own: PostgreSQL playground