in reply to Re^2: inserting a column into mySQL DB with perl
in thread inserting a column into mySQL DB with perl

Yes, all columns of a composite primary key must be duplicated in child tables. While they do have their place, common practice is to use a surrogate key instead. This isn't necessarily good or bad practice, it's just what people do.

Regardless, the suggestion wasn't for a composite key. When applications track individual vehicles, the VIN is (one of) the best ids, because it uniquely identifies this instantiation of a vehicle. Everything else is merely an attribute, and thus should not be part of the key. If the application is classifying types of cars, however, VIN would be a terrible key, as it identifies individual cars, and not a cars type. For that, it begins to matter if the make or model is an important factor. If it is, it would be a good candidate for (begin part of) the primary key, otherwise, it is just an attribute.

  • Comment on Re^3: inserting a column into mySQL DB with perl