Given a table of user logins and a table of task executions, write a query to find which user segments have the highest ratio of tasks executed per login.
Count every task execution, exclude logins without a non-null segment, and return all segments tied for the highest ratio.
user_segment, login_count, task_count, and tasks_per_loginuser_segment ascending to break ties consistently| Column | Type | Description |
|---|---|---|
| login_idPK | INT | Unique identifier for a login event |
| user_id | INT | Identifier of the user who logged in |
| user_segment | VARCHAR(50) | Segment assigned to the user at login time |
| login_at | TIMESTAMP | Timestamp of the login event |
| Column | Type | Description |
|---|---|---|
| execution_idPK | INT | Unique identifier for a task execution |
| user_id | INT | Identifier of the user whose task was executed |
| executed_at | TIMESTAMP | Timestamp of the task execution |
| status | VARCHAR(20) | Execution status; every row represents an execution |