Re: Number of foreign keys

From: Tony Andrews <>
Date: 2 Dec 2004 03:20:07 -0800
Message-ID: <>

Vinodh Kumar P wrote:
> I understand the number of foreign keys allowed is restricted by the
> use.
> In a general relational schema design perspective how many foreign
keys a
> table shall have?
Precisely as many as it requires - no more, no less. If that is more than your DBMS allows then you have an issue.

> If I have large number of foreign keys what anamolies it will lead
None. It is the LACK of required foreign keys that will lead to anomalies.

> Is this crucial to identify all the foriegn key relationships for a

Having said all that, if you find yourself designing a table that needs 100s of foreign keys, many of them referencing the same parent table, then it is quite likely that your design isn't good. For example this is a bad design:

CREATE TABLE department

, empno1 REREFENCES employee
, empno2 REREFENCES employee
, empno3 REREFENCES employee
, empno4 REREFENCES employee
, empno5 REREFENCES employee
, empno6 REREFENCES employee
, empno7 REREFENCES employee
, empno8 REREFENCES employee
, empno9 REREFENCES employee

); Received on Thu Dec 02 2004 - 12:20:07 CET

Original text of this message