1

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.

Community
  • 1
  • 1
Vinayak
  • 1,103
  • 3
  • 18
  • 40
  • 1
    Your question sounds a lot like [this one](http://stackoverflow.com/questions/19437686/entity-relationship-diagram-entity-which-can-have-multiple-types). – Benny Hill Oct 18 '13 at 19:37
  • Yes, that's very similar to this question, and makes things a little more clear. Thanks again for pointing me to it. – Vinayak Oct 18 '13 at 19:46

2 Answers2

3

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

r3mainer
  • 23,981
  • 3
  • 51
  • 88
  • 1
    That's pretty much the Many-to-Many relationships on the question you linked. – Rafael Oct 18 '13 at 19:35
  • Thanks! That's exactly what I was looking for. Sorry about the stupid question. I guess I wasn't really thinking straight. – Vinayak Oct 18 '13 at 19:41
1

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

Sobin Augustine
  • 3,639
  • 2
  • 25
  • 43