Interview Query

Lifetime Plays

3
Have you seen this question before?

We have a table called song_plays that tracks each time a user plays a song.

Let’s say we want to create an aggregation table called lifetime_plays that records the song count by date for each user.

Write a SQL query that could perform this ETL each day.

song_plays table

column type
id INTEGER
created_at DATETIME
user_id INTEGER
`song_id INTEGER
Next question: Monthly Product Sales
.....
Loading comments