A nightly batch job runs once a day. Days when it failed are listed in failed and days when it succeeded are listed in succeeded; every day appears in exactly one table. For January 2025 only (2025-01-01 to 2025-01-31, using only days inside that range), merge consecutive days with the same result into periods. Write an SQL query that returns period_state ('failed' or 'succeeded'), start_date and end_date for each period. Order the results by start_date ascending.
Loading…
Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.
Ask questions, share alternate queries, and explore solutions
Your recent query executions and answer checks
This will insert the verified MySQL solution into your editor so you can study how each clause transforms the table.