Your question is SQL: Most Clicked Ad. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Identify the ad with the most clicks.
Asked in the Technical SQL round stage. Conceptually similar SQL problem reflecting what was asked in the interview.
Write a SQL query to return the ad or ads with the highest total number of clicks.
ad_id, ad_name, total_clickstotal_clicks descending, then ad_id ascending| Column | Type | Description |
|---|---|---|
| ad_idPK | INT | Unique identifier for the ad |
| ad_name | VARCHAR(255) | Human-readable ad name |
| campaign_name | VARCHAR(255) | Campaign the ad belongs to |
| is_active | BOOLEAN | Whether the ad is currently active |
| Column | Type | Description |
|---|---|---|
| click_idPK | INT | Unique identifier for the click event |
| ad_id | INT | Ad that received the click |
| clicked_at | TIMESTAMP | Timestamp when the click occurred |
| device_type | VARCHAR(50) | Device used for the click |