Jump to content

Adding Playlists Feature to My Website


limitphp

Recommended Posts

A user will be allowed to add a song to a playlist.  A user can have multiple playlists.

 

To allow this feature, should I have a table called playlists with the following columns:

playlistID    playlistName    userID    songID

 

Or should I break it into 2 tables playlists and playlist_songs?

Where table playlists has the following columns:

playlistID    playlistName    userID

 

and playlist_songs has the following columns:

playlistID    songID

 

 

 

thanks for any suggestions and help.

 

Link to comment
https://forums.phpfreaks.com/topic/144501-adding-playlists-feature-to-my-website/
Share on other sites

actually, now that I think about it, it seems to make more sense to break it into 2 tables.

 

However, should the second table (playlist_songs) have anotehr column, an id column?

even though there will never be more than one entry with the same playlistID and songID.

 

Is it a good idea to always use an id column as an identifying column, just in case?

Where are the songs coming from? I would use one table, a playlist holds a group of items, not individual items! I also don't see any relationships that possible could be shared among different users so why create a second table?

 

songs come from table songs:

columns: id, artistID, songName, songNameHash, genre

 

 

if I use one table that holds:

playlistID    playlistName    userID    songID

 

then, wouldn't that repeat playlistName and userID unnecessarily?

 

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.