Listens
table to find all pairs of users who listened to the same song on the same day.HAVING
clause to filter groups that have listened to at least three distinct songs.Friendship
table to ensure the user pairs are friends.erDiagram Listens { int user_id int song_id date day } Friendship { int user1_id int user2_id } Listens }|--|| Friendship : ""