Loading...

The Vote Tally

A hard SQL interview practice problem on DataDriven. Write and execute real sql code with instant grading.

Domain
SQL
Difficulty
hard

Problem

Combine purchase rows (product_id = 1001, total_amount >= 0, transaction_date between '2024-01-01' and '2024-04-30') with refund rows (product_id = 1001, total_amount < 0, any date). Per transaction_date in the combined set, SUM(total_amount) as net_revenue. Return transaction_date and net_revenue sorted chronologically.

Practice This Problem

Solve this SQL problem with real code execution. DataDriven runs your SQL queries against a real database and grades it automatically.