Re: circular relationships ok?

From: Alexandr Savinov <>
Date: Thu, 02 Mar 2006 18:13:28 +0100
Message-ID: <440727b9$>

David Portas schrieb:
> Let's try an even simpler and even more common example: An
> organizational hierarchy.
> CREATE TABLE Employees
> (employee_id INTEGER PRIMARY KEY,
> employee_name VARCHAR(50) NOT NULL,
> manager_id INTEGER NOT NULL
> REFERENCES Employees (employee_id),
> CHECK (employee_id =0 OR employee_id <> manager_id));
> The business rule is that each employee has a manager who is also an
> employee.

An arrow goes from Employee up, then turns down and then comes to this concept from down:

Employee |


That is very simple. Loops (self-references) can be used because they are very convenient and frequently used. And they have clear and unambiguous semantics. My opinion that loops should be permitted but not cycles. Cycles do not have unambiguous semantics. If you can explain to your database how to interpret them then cycles can also be used but I do not know such an interpretation. And, IMHO, it is reason why contemporary database do not manage such relationships - it is a task of the programmer.

Received on Thu Mar 02 2006 - 18:13:28 CET

Original text of this message