Event Type with the Most Events
Problem statement
Given an event log, return the event type with the largest number of event rows.
If several types tie, return the alphabetically smallest type. Return exactly event_type and event_count.
Table schema
MySQLPostgreSQLPandas
Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.
events
| Column | Type | Nullable | Description |
|---|---|---|---|
| event_idPK | Integer | No | — |
| user_id | Integer | No | — |
| event_type | Text | No | — |
| event_time | Timestamp | No | — |
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| event_type | Text | No | — |
| event_count | Integer | No | — |
Row order: must match exactly. Numeric tolerance: 0.
Constraints
- At least one event is present.
- Count every event row, including repeated events from the same user.