Results 1 to 8 of 8
Thread: Creating play lists schemas
Feb 19, 2010, 16:53 #1
- Join Date
- Nov 2007
- 0 Post(s)
- 0 Thread(s)
Creating play lists schemas
I've been thinking all day of how to create a play list that will avoid duplicating data.
This is what I can make up with
CREATE TABLE `play_lists` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, `userID` INT NOT NULL, `name` VARCHAR(255) NOT NULL, `date` DATETIME NOT NULL FOREIGN KEY userID(userID) REFERENCES users(id) ON DELETE CASCADE ) ENGINE = innoDB; CREATE TABLE `play_listSongs` ( `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `play_listID` int(11) NOT NULL, `songID` int(11) NOT NULL, `date` datetime NOT NULL, FOREIGN KEY play_listID(play_listID) REFERENCES play_lists(id) ON DELETE CASCADE, FOREIGN KEY songID(songID) REFERENCES uploaded_songs(uploaded_songID) ON DELETE CASCADE ) ENGINE = innoDB;
The problem is that my friend says that he also needs a repository of all songs that are in the play lists.
The problem is that, if a user does not create an initial play list than the above tables will not work correctly. Also, if the user inserts a song into a play list then the repository would not have that new song that was inserted.
His method would be to create a table that stores ALL your songs that you have and also the tables I created and reference them to each other.
The problem is that the repository table would contain ALL your songs AND the play_listSongs table would also contain all your songs.
Is there another method to meet his needs that I am missing out on?