Mockbit/#55
SQLmediumWindow functions~15m

AdMetrics Agency manages digital advertising campaigns across multiple channels

Problem

AdMetrics Agency manages digital advertising campaigns across multiple channels. They need to identify campaigns that show declining performance by analyzing impression volume trends. A campaign is considered 'declining' if it has at least 3 consecutive days where daily impressions are lower than the previous day. For each declining campaign, return the campaign_id, campaign_name, advertiser_name, and the start_date of the first declining streak (the first day in the longest sequence of consecutive declines). If multiple streaks exist of the same length, return the earliest start_date. Order results by start_date, then by campaign_id.

Examples

Example 1

Example 2

Constraints
  • Return campaigns with at least 3 consecutive declining days
  • Show the start_date of the first (earliest) declining streak if multiple exist
  • Order by start_date, then campaign_id
  • Handle cases where campaigns have mixed patterns
Reference solution

Reference solution available after you attempt the question.

Ready to solve it?

Start a session on Mockbit #55. Write your SQL, run it against real data, and get graded on correctness, efficiency, query structure, and business understanding.

Related SQL questions
← Back homemockbit.io/q/55
PrivacyTerms© 2026 Mockbit