Need help with query with IF and joins

Can someone help me build a query that gives out this output:

On the top is my current database, on the bottom the table im trying to get with querys and considering for my express server the query only recieve playlist_id=1, it should make a new artistNum if it has more than 2 artists

Please make an effort at solving your homework, then post what you have and ask a specific question if you get stuck.