
Write Standard SQL to compute, for a given date (use 2025-09-01), each user's total valid usage minutes. Schema and rules:
Schema (timestamps are UTC): Table: user_activity
Rules:
Sample data (minimal, for understanding): user_activity +---------+---------------------+---------------------+ | user_id | start_ts | end_ts | +---------+---------------------+---------------------+ | 1 | 2025-09-01 00:30:00 | 2025-09-01 01:00:00 | | 1 | 2025-09-01 01:10:00 | 2025-09-01 02:00:00 | | 1 | 2025-09-01 03:05:00 | 2025-09-01 03:20:00 | | 2 | 2025-08-31 23:50:00 | 2025-09-01 00:10:00 | | 2 | 2025-09-01 00:20:00 | 2025-09-01 00:50:00 | | 2 | 2025-09-01 02:00:00 | 2025-09-01 02:45:00 | | 3 | 2025-09-01 10:00:00 | 2025-09-01 10:30:00 | | 3 | 2025-09-01 11:35:00 | 2025-09-01 12:00:00 | | 4 | 2025-09-01 23:30:00 | 2025-09-02 00:15:00 | | 5 | 2025-09-01 08:00:00 | 2025-09-01 08:30:00 | | 5 | 2025-09-01 08:35:00 | 2025-09-01 09:00:00 | | 5 | 2025-09-01 10:00:00 | 2025-09-01 10:59:59 | +---------+---------------------+---------------------+
Assumptions to honor: timestamps are precise to the second; ignore rows where end_ts <= start_ts; do not use procedural code—solve with SQL window functions/aggregation.