Interview Query

Third Unique Song

9
Have you seen this question before?

Given a table of song_plays and a table of users, write a query to extract the earliest date each user played their third unique song.

Example:

Input:

song_plays table

Columns Type
user_id INTEGER
song_name TEXT
date_played DATETIME

users table

Columns Type
id INTEGER
name VARCHAR

Output:

Columns Type
name VARCHAR
date_played DATETIME
song_name TEXT
Next question: Kernel Methods
.....
MySQL 8.0.17
Loading editor
Use Shift + Enter to run query