@configurator said:
Why isn't the primary key (ProductId, Age, Gender)
? Because nobody here knows what a compound key actually is.
Surrogate Keys vs Natural Keys is one of the biggest and oldest flamewars in the DB world. You and I are obviously on different sides of this one. I'll give you a few simple reasons why surrogate keys are better.
Do you think it is safe to have SSNs as PRIMARY KEY? If you say "yes", then you'd be WRONG. A) uniqueness is not a gaurantee SSNs can make B) they can change
Do you think it is safe to have PRIMARY KEY(First Name, Middle Name, Last Name)? if you say "yes", then you'd be WRONG A) uniqueness cannot be gauranteed B) they change change.
All natural keys are derived from mutable data, which can lead to issues in when you have to update your key linkages, and almost nothing in the real world can gaurantee uniqueness. Primary Keys MUST be unique, and in the opinion of most good designers Primary Keys SHOULD never need to be changed.