Loading...
Best Selling Product by Month
A hard SQL interview practice problem on DataDriven. Write and execute real sql code with instant grading.
- Domain
- SQL
- Difficulty
- hard
- Seniority
- mid
Problem
The merchandising team needs a monthly leaderboard of top-grossing products. Revenue is calculated as quantity times the product's listed price. Exclude any transaction where total_amount is negative, as those represent refunds. If two products tie in a given month, include both. Return the month, product name, and total revenue.
Practice This Problem
Solve this SQL problem with real code execution. DataDriven runs your SQL queries against a live PostgreSQL database and grades it instantly.