Advertising System Failures Report
Problem statement
HackerAd analyzes events from advertising campaigns. Produce a report of every customer who has more than three campaign events whose status is exactly failure.
Return two columns: customer, the customer's first and last names separated by one space, and failures, the total number of matching failure events across all campaigns owned by that customer.
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.
customers
| Column | Type | Nullable | Description |
|---|---|---|---|
| idPK | Integer | No | — |
| first_name | Text | No | — |
| last_name | Text | No | — |
campaigns
| Column | Type | Nullable | Description |
|---|---|---|---|
| idPK | Integer | No | — |
| customer_id | Integer | No | — |
| name | Text | No | — |
Foreign key: customer_id → customers(id)
events
| Column | Type | Nullable | Description |
|---|---|---|---|
| dtPK | Timestamp | No | — |
| campaign_id | Integer | No | — |
| status | Text | No | — |
Foreign key: campaign_id → campaigns(id)
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| customer | Text | No | — |
| failures | Integer | No | — |
Row order: any order is accepted. Numeric tolerance: 0.
Constraints
- Only rows whose status is exactly
failurecount. - A failure is attributed through
events.campaign_id -> campaigns.id -> campaigns.customer_id -> customers.id. - Include a customer only when the total number of failures is greater than three.
- Each customer ID, campaign ID, and event timestamp is unique within its table.
- The result row order is not significant.