limitphp Posted February 9, 2009 Share Posted February 9, 2009 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 More sharing options...
limitphp Posted February 9, 2009 Author Share Posted February 9, 2009 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? Link to comment https://forums.phpfreaks.com/topic/144501-adding-playlists-feature-to-my-website/#findComment-758351 Share on other sites More sharing options...
printf Posted February 9, 2009 Share Posted February 9, 2009 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? Link to comment https://forums.phpfreaks.com/topic/144501-adding-playlists-feature-to-my-website/#findComment-758353 Share on other sites More sharing options...
limitphp Posted February 9, 2009 Author Share Posted February 9, 2009 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? Link to comment https://forums.phpfreaks.com/topic/144501-adding-playlists-feature-to-my-website/#findComment-758376 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.