SQL music playlist database design

Dan Fumosa picture Dan Fumosa · Nov 23, 2015 · Viewed 7.8k times · Source

I had a question about how to structure my tables for a database with songs and playlists. My initial thought was to create a table of playlists titles and id's and then a playlists songs table that holds the songs unique id and the playlist in which it belongs to.

The other plan was to create a new table for each playlist that gets created and store the song information inside each table for the playlist. The question is, would this be a good approach or is there some reason that creating these new tables would be bad for performance or any other reason? Thanks for the help!

Answer

chrisShick picture chrisShick · Nov 23, 2015

How about something like this?

Songs:

id title length artist_id

Artists:

id name

Playlists:

id title user_id 

Playlists_Songs:

playlist_id song_id

Users:

id name email