Data Relationships
Types of Data Relationships
one-to-many
Single primary key has many foreign keys. A person many have many email addresses.
The relationship is created in the diagram too by dragging on primary key to the foreign key.
one-to-one
A Single primary key may only have on foreign key. A sweater can only be one color.
many-to-many
A junction table is used to normalize data. A student may take many courses and a course may have many students.
Notice the compound key in the StudentCourses table.
This compound key consists of two foreign keys. One form the Student table and one from the Course table. This allows a student to have many courses and a course to have many students. To make this example complete we could add a third foreign key from a semesters table that allows students to retake a course in a new semester. I'll leave this till later.
A person may also have many roles in a logon system.