About the “Gross Merchandise Value & Refund Rate” SQL Problem
Business Scenario
E-commerce merchants frequently suffer from high return rates in certain product categories. The VP of Operations wants to audit total gross sales (GMV) and calculate the percentage of total sales refunded per category.
Expected Output & Criteria
Summary table of category, total_orders, total_gmv, and refund_rate_pct sorted by highest refund rate first.
Database Table Schema (PostgreSQL DDL)
PostgreSQL 16 WASMThis challenge executes directly against the following relational schema in your browser:
CREATE TABLE orders (
order_id INT PRIMARY KEY,
category VARCHAR(50) NOT NULL,
order_amount NUMERIC(10, 2) NOT NULL,
refunded_amount NUMERIC(10, 2) NOT NULL DEFAULT 0.00
);Target SQL Clauses & Operators
Want more Aggregations practice?
Explore the full syllabus of 12 exercises, syntax guides, and interview pitfalls.