Click here to Skip to main content
15,896,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi everyone !
I'm trying to get the sense of using IDENTITY columns in composite primary key... Suppose I have a relation

    Artists(#ArtistID,Artist Name)

and another relation

    Tracks(#TrackID, #ArtistID, Track Name, Genre)

I think that due to identity columns the relation "Each artist has many tracks" would be right...

#TrackID is always unique even in combination with #ArtistID, so "each Artist has many tracks", but not "each track could be met in many artists"
(if #TrackID wasn't IDENTITY column) - that would be wrong, right????

it helps to build a relation in one side only .."EACH ARTIST HAS MANY TRACKS, BUT EACH TRACK COULD BE MET ONLY IN ONE ARTIST"

explain please
Posted
Updated 25-Jul-10 2:16am
v2

The unique ID merely identifies the record. Your assumption that one song can only be attributed to a single artist is flawed because many artists might cover the same song. For instance, I know of at least a dozen versions of the title Ghost Riders In The Sky, and some of those versions are from the same artist, but many of them are by different artists.

The only thing that can be called unique is an album by a given artist.

I think you have to sit down and re-think your database organization.
 
Share this answer
 
You can have a look at this[^] database model as a starter.
This one is also flawed if you want to be picky.
It doesn't take into account that an artist and a band with its members aren't the same thing. It also doesn't take into account that sometimes an artist changes his/hers artist name, but you would still like to have the albums listed together.

But it's a starter.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900