jeudi 7 avril 2016

Can I do two select on a database with two primary keys?

Hello all Im working on the db for a music app and I have this so far.

Song 
SongId Name Artist

Playlist
PlaylistId Name

Playlist_with_songs
id (fk)PlaylistId  (fk)SongId

last table both are a primary key.

So I am wondering how my query will look like. Ex. If I want to get all the songs with playlistId 5, then I would have to get the actual songs from the Song tables what statement could I use.

Also, Is this a good format to follow if in the case of a playlist being deleted BUT still keeping all the songs available. Would cascade work there?

Thanks (I am using sqlite.)

Aucun commentaire:

Enregistrer un commentaire