Loading...

Previous Day Top Service

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

Domain
SQL
Difficulty
hard
Seniority
mid, senior

Problem

Build a daily revenue dashboard widget that shows each date's top-spending service from the previous day. Round totals to 2 decimal places before comparing. If multiple services tie for the top spot, show all. Only include dates where prior-day data exists. Return the billing day, service name, and total amount.

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.