Say I've this table:
Person table -------------- PersonId Address table ------------ AddressId PersonAddressId
where PersonAddressId is PersonId and also the foreign key. Can there be any kind of database breach in renaming the foreign key? It may become really perplexing to utilize whether they have different names.
It's generally useful to title the foreign key column just like the main key column it references, where possible.
Obviously, sometimes it isn't possible:
- Two posts in
Addressmight both be foreign secrets to
Person, so clearly you cannot title both posts
- Some tables have a foreign answer to itself, e.g.
Employee.manager_idmight be a mention of the
Employee.employee_id. Again, you cannot title the column just like the recommended primary type in this.
You will find no strict naming conventions in SQL. One source for recommended metadata naming conventions is ISO 11179.
Agreed which explains why the convention would be to title PersonAddressId as PersonId.