SQL music playlist database design

家住魔仙堡 提交于 2019-12-24 12:04:01

问题


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!


回答1:


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 



回答2:


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.



来源:https://stackoverflow.com/questions/33861987/sql-music-playlist-database-design

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!