I probably should never have taken that psychology class, but because there is a word "id", I always uppercase the abbreviation for identifier, thus I use "ID". I've experimented both with just using ID and ProductID for the primary key name. Because I use LINQ and simply map the class in the designer, I've taken to naming the columns the way I want them in my code. Because I'd prefer to have product.ID
than product.ProductID
, I use the shorter name. For foreign keys, I use the table/column format (with no separator), so the foreign key would become ProductID. This isn't an issue for me in my code, though, because I almost always use the mapped entity, e.g., cart.Product
rather than the key itself, cart.ProductID
.
EDIT: Note I'm assuming a target of the .NET framework, thus using (mostly), the naming conventions from .NET. If I were doing Rails development, these would probably be lowercase and I would use underscores as separators.