Spotify interview question

create python function, sql query