Loading...

Consistent High-Quantity Revenue

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

Domain
SQL
Difficulty
medium
Seniority
mid

Problem

Compute total transaction revenue for each user and product pair, but only for pairs where every single transaction had a quantity of at least 2. If any transaction for that pair falls below 2, exclude the entire pair. Show user, product, and total revenue, listed by user ascending and revenue descending.

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.