Reputation: 113
In order to learn MySQL I'm building a music CD database, which is pretty complex but so far I'm doing rather well. I have set up, among others, a table with albums
, another with artists
and an album_artists
one which links album_id
's with artist_id
's. But in an album with various artists, usually one, or some, of them are the main artists, so when making a query I shouldn't order them by alphabetical or id order, but by primary or secondary. Question is:
Should I make a separate table of secondary_artists
, identical to the original album_artists
one, or make a boolean isPrimary
field in the album_artists
table? Are both ways acceptable?
Upvotes: 1
Views: 113
Reputation: 108686
Many bibliographic / discographic schemes for recording multiple creators assign an ordinal number to each contributor. So, instead of a flag indicating "primary", your album_artist table could contain
album_id artist_id artist_order
So if
your album_artist table would have these rows.
album_id artist_id artist_order
312 87 1
312 33 2
312 50 3
This would give you sufficient information to get the artists in the order mentioned in the work (which is the right order for most catalogs).
Don't put "secondary" artists in a different table.
Upvotes: 2