Reputation: 103
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?
Upvotes: 4
Views: 11178
Reputation: 2042
In terms of relational design, you need two tables for playlists, one holding the playlistname (key, playlistname), one for the actual playlists (key,playlistkey,trackid) Table for tracks holding mp3 tag details (key, track title, artist key, album .... Etc) Table for Artists (key, name, band). You can break it down further applying the principle that you should not duplicate data for instance holding a playlistname in more than one table. By creating views, you knit all this together
However, if you are using android, this database already exists.
Upvotes: 0
Reputation: 1096
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
Upvotes: 9