Page Recommendations
Start Timer
0:00:00
You’re the data scientist for Facebook local businesses. Each local business has a page that can sponsor an ad in different local zip codes.
Write a query that for every page, gets the percentage of the users who ended up recommendeding the page and live in the same postal code as the page sponsorship.
Note: A page can sponsor multiple postal codes.
Example:
Input:
page_sponsorships table
| Column | Type |
|---|---|
page_id |
INTEGER |
postal_code |
VARCHAR |
price |
FLOAT |
recommendations table
| Column | Type |
|---|---|
user_id |
INTEGER |
page_id |
INTEGER |
users table
| Column | Type |
|---|---|
id |
INTEGER |
postal_code |
VARCHAR |
Output:
| Column | Type |
|---|---|
page |
INTEGER |
postal_code |
VARCHAR |
percentage |
FLOAT |
.
.
.
.
.
.
.
.
.
Comments