Write a SQL query to find the top three most visited websites on our network for each region over the last 30 days.
Use the network visit records and website metadata. Return exactly three websites per region when at least three qualify. Ties are resolved by the smaller website ID.
region, website_id, website_name, visit_count, and website_rank.region, then website_rank, then website_id.| Column | Type | Description |
|---|---|---|
| visit_idPK | INT | Unique identifier for a website visit |
| website_id | INT | Website visited |
| region | VARCHAR(50) | Network region where the visit occurred |
| visit_date | DATE | Calendar date of the visit |
| Column | Type | Description |
|---|---|---|
| website_idPK | INT | Unique website identifier |
| website_name | VARCHAR(255) | Website domain name |
| category | VARCHAR(100) | General website category |