This is (I think) a generic question, but here's a specific example. Suppose that:
Albumseach have 1-nTracks.- Each
Trackis in exactly oneAlbum. (Even if "Logging with the Bloggs" appears in both Bloggs' First Album and Bloggs' Greatest Hits, these are 2 entities for my purposes.) - Each
Trackhas exactly oneArtist. Artistshave 1-nTracks.- Each
Albumhas 1Album_Artist. (Where all theTracksare by Bloggs, theAlbum_Artistis Bloggs. Where theTracksare by different Artists, as in A Collection of Great Logging Songs, theAlbum_Artistis Various.
I want to be able to answer questions like:
- List all the Bloggs albums
- Find all the Bloggs
Trackswith 'logging' in the title - List all the
Album_Artists.
So what's the best table model?
Currently I have an Artists table with a boolean column for IsAlbumArtist?
Then Tracks has a foreign key Artist_id and a foreign key Album_id .
and Albums has a foreign key Artist_id
But would it be preferable to have a separate AlbumArtists table, or is this a moment to think about table inheritance?
Thanks for any design info and tips!