AnalystPath

Top-Day Revenue Gap Between Two Branches

SQLEasyJunior level~15 min

Problem

Table: `daily_sales`

| Column Name | Type |
|---|---|
| branch | varchar |
| sale_date | date |
| revenue | int |

Each row is the total revenue a bookstore branch earned on one day.

Find the absolute difference between the single best day at the `Riverside` branch and the single best day at the `Hilltop` branch. Return one row with that value aliased as `revenue_gap`.

Tables

Example rows — the live problem includes the full dataset.

daily_sales
branchsale_daterevenue
Riverside2024-04-011200
Riverside2024-04-023100
Riverside2024-04-032500

Expected output

Your answer should return 1 row with the columns revenue_gap.

Starter code (SQL)

SELECT *
FROM daily_sales;

Solve this SQL question free

Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related SQL questions