SQL Server allows me to create multiple foreign keys on a column, and each time using just different name I can create another key referencing to the same object. Basically all the keys are defining the same relationship. I want to know what's the use of having multiple foreign keys which are defined on the same column and reference to the same column in another table. What's the benefit of it that SQL Server allows us to do a thing like that?
SQL Server Foreign Key – Multiple Foreign Keys on Same Column
foreign keysql server
Related Question
- Postgresql – Need for indexes on foreign keys
- Oracle 11g – Creating Composite Primary Key from Multiple Tables
- Foreign Keys – Primary Key Not Clustered Index
- Database Design – Handling Multiple Foreign Keys on a Single Column
- SQL Server – Composite Primary Key on Partitioned Tables and Foreign Keys
- SQL Server 2017 – How to Rename Foreign Keys En Masse
Best Answer
There is no benefit to having redundant constraints that differ only by name. Similarly, there is no benefit to having redundant indexes that differ only by name. Both add overhead without value.
The SQL Server database engine does not stop you from doing so. Good constraint naming constraint naming conventions (e.g. FK_ReferencingTable_ReferencedTable) can help protect one against such mistakes.