Question

I am designing a database to store metadata about music.
For instance, I would store the following data:

Song      : A Year Without Rain
Album     : A Year Without Rain
Artist    : Selena Gomez & the Scene
Composers : Lindy Robbins, Toby Gad

...into these 5 tables:

Songs      : song_ID, songTitle, album_ID, artist_ID, composer_IDs
Albums     : album_ID, albumTitle
Artists    : artist_ID, artistName, performer_IDs
Performers : performer_ID, performerName
Composers  : composer_ID, composerName

The problem is, for a given song (song_ID), there could either be one or more more than composer (composer_IDs) associated with it. The same goes for the number of members (performer_IDs) in a band (artist_ID).

I don't want to use arrays or comma-separated values to store multiple values in these columns. How do I fix this problem?

I already read this answer, but I couldn't figure out how to implement that with this design. Any help would be appreciated.

Was it helpful?

Solution

Create another table called Song_Composer, containing two columns: Song_ID and composer_ID. Then you can associate as many composers as you like with each song by adding rows with the same song ID

OTHER TIPS

Change the table structure and also add two tables SongsComposers & ArtistsPerformers

Songs : song_ID, songTitle, album_ID, artist_ID

Composers : composer_ID, composerName

SongsComposers :song_ID,composer_ID

Artists : artist_ID, artistName

Performers : performer_ID, performerName

ArtistsPerformers :artist_ID,performer_ID

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top