Daily Ad Revenue Trend
What is the total ad revenue and click count for each day?
- Aggregation
- Date analysis
- Numeric functions
- Sorting
Challenge brief
Understand the request
Ads Finance is building a daily revenue dashboard and needs total click revenue per day to monitor ad performance trends.
Return click_date, daily_revenue, click_count in the declared deterministic order.
Return
- click_date
- daily_revenue (rounded 2)
- click_count
Constraints
- Return one row per click date
- Round revenue to two decimals
- Order chronologically
Data you will use
Review the relevant tables before deciding how to join, filter, or aggregate them.
ad_clicks
click_dateDATErevenueREAL
Hints, when you need them
Open one clue at a time so you still do the reasoning.
Hint 1
Each click contributes revenue to one click date.
Hint 2
Aggregate count and revenue at daily grain.
Hint 3
Round revenue and return the series chronologically.
Verified SQL answer
Attempt the problem first, then compare structure and reasoning—not just syntax.
Reveal solution and explanation
SELECT click_date, ROUND(SUM(revenue), 2) AS daily_revenue, COUNT(*) AS click_count FROM ad_clicks GROUP BY click_date ORDER BY click_dateWhy this works
Single-table GROUP BY. Jan 24 has the highest daily revenue ($11.70) from 3 clicks. ROUND(SUM(revenue), 2) prevents floating-point display issues.
Success check
Returns the complete deterministic result for daily ad revenue trend
Expected result
Use this output to verify values, aliases, ordering, and row count.
| click_date | daily_revenue | click_count |
|---|---|---|
| 2024-01-10 | 6.25 | 2 |
| 2024-01-11 | 1.25 | 1 |
| 2024-01-12 | 7.5 | 2 |
| 2024-01-13 | 4.2 | 1 |
| 2024-01-14 | 6.55 | 2 |
| 2024-01-15 | 5.4 | 2 |
| 2024-01-16 | 9.5 | 2 |
| 2024-01-17 | 3.2 | 1 |
| 2024-01-18 | 7.65 | 3 |
| 2024-01-19 | 6.8 | 2 |
Previewing 10 of 16 expected rows. Run the query in the editor to inspect the full result.
Learn the concepts behind this answer
Strengthen your understanding with these targeted learning topics:
Continue practicing
Explore related company challenges
Meta
Independent Meta-style social-product, engagement, content, community, messaging, and advertising SQL practice.
Microsoft
Independent Microsoft-style cloud, productivity, subscription, usage, support, and customer analytics SQL practice.
Netflix
Independent Netflix-style streaming, subscription, catalog, ratings, and engagement SQL practice.
Return to the complete interview preparation experience.