Question

class diagram http://img223.imageshack.us/img223/8558/classdiagram.png

In this image, why is the EmployeeID pointing to it's own table while the order id is not pointing to the order's table. The screenshot is a picture of the northwind database.

Was it helpful?

Solution

Because employees [EmployeeID] report to other Employees [ReportsTo]. An order belonging to another order hurts my brain.

OTHER TIPS

The EmployeeID is probably being referred to by the ReportTo field. For example, a given employee reports to another employee, using EmployeeID as the reference.

The OrderID does not point to the Order table because there are no other fields in the Order table that uses/refers to the OrderID.

This is commonly referred to as a "self-join".

Notice that an Employee could be subordinate to another one (ReportsTo) so you need the EmployeeID for that which is the PK of this table.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top