SQL · Intermediate · 35 min
Prices that rise every month
Check strict growth and calendar continuity together.
Task
Return products with at least three recorded months whose prices strictly increase from one month to the next. A missing calendar month disqualifies the product.
Requirements
- monthly_prices has product_id, month, price_cents. Each product/month is unique.
- month is an ISO date on the first day of the month. Prices are non-null integer cents.
- All recorded months for a qualifying product must form one consecutive run. Equal or falling prices disqualify it.
- Return product_id ordered ascending. Use SQLite.
LAGDate continuityGrouped validation
Loading exercise…