Interview Query

Download Facts

Start Timer

0:00:00

Upvote
35
Downvote
Save question
Mark as completed
View comments (93)
Next question

Given two tables: accounts, and downloads, find the average number of downloads for free vs paying accounts, broken down by day.

Note: You only need to consider accounts that have had at least one download before when calculating the average.

Note: round average_downloads to 2 decimal places.

Example:

Input:

accounts table

Column Type
account_id INTEGER
paying_customer BOOLEAN

downloads table

column type
account_id INTEGER
download_date DATETIME
downloads INTEGER

Output:

Column Type
download_date DATETIME
paying_customer BOOLEAN
average_downloads FLOAT
.
.
.
.
.


Comments

Loading comments...