mysqldatabasesqlitedatabase-designplaylist

Music playlist database design


How to structure tables for songs and playlists?

My thought was to create a table of playlists titles and id's then a playlists songs table that holds the songs unique id and the playlist which it belongs to. The other plan a new table for each playlist and store song information in each table for the playlist.

Would this be a good approach or is creating new tables bad for performance or any other reason?


Solution

  • 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