SQL Practice Logo

SQLPractice Online

Scenario SQL Question

Conditional Aggregation - Sum by Category

Build mastery in Case Statements with this scenario-based SQL challenge and live execution support.

Problem Statement

For each product_category, compute conditional_total_sales: Electronics → SUM all sales; Furniture → SUM only sales where sales_amount > 5000; any other category → SUM only sales whose order_status = 'Completed'. Return product_category, conditional_total_sales — ordered by product_category.

Relevant Tables

sales_orders

SQL Concepts Used in This Scenario

Strengthen your understanding with these targeted learning topics: