After the database designers define the entities and translate them into database tables, they add linking tables to resolve the many-to-many relationships, and add primary and foreign keys to the tables. Now the designers can create foreign key relationships between tables. The following table shows the relationships the designers create.
| From (column and table on the one side of the relationship) | To (column and table on the many side of the relationship) |
|---|---|
| ActivityTypeId (ActivityType table) | ActivityTypeId (Activity table) |
| GradeId (Grade table) | GradeId (PersonActivity table) |
| GradeScaleId (GradeScale table) | GradeScaleId (Grade table) |
| GradeScaleId (GradeScale table) | GradeScaleId (Group table) |
| GradeScaleId (GradeScale table) | GradeScaleId (Activity table) |
| GradeScaleId (GradeScale table) | GradeScaleId (ActivityType table) |
| GroupId (Group table) | GroupId (PersonGroup table) |
| GroupId (Group table) | GroupId (Activity table) |
| LocationId (Location table) | LocationId (Group table) |
| LocationId (Location table) | LocationId (Activity table) |
| PersonId (Person table) | PersonId (Logon table) * |
| PersonId (Person table) | PersonId (PersonGroup table) |
| PersonId (Person table) | PersonId (PersonActivity table) |
*This is a one-to-one relationship.
You can create foreign key relationships in SQL Server 7.0 in two ways:
The following diagram shows the Eval database after the foreign key relationships are built.
