One-to-One Relationship
primary key = Student ID
secondary key = Student Code
Destination Table | 1 : 1 |
(Outside) Source Table |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Table 1: Student Contact Data
|
|
Table 2: Student Finances
|
After joining it looks like this...
Student ID |
Name |
Phone |
Program |
Student Code
|
Name | Tuition |
Amount Paid
|
Owing |
39 |
John |
321.1234 |
Music |
39 |
John L |
3000 | 3000 | 0 |
45 |
Paul |
321.2345 |
Music |
45 |
Paul M |
3000 | 3000 | 0 |
56 |
George |
321.3456 |
Music |
56 |
George.H |
3000 | 3000 | 0 |
88 |
Ringo |
321.4567 |
Music |
88 |
Ringo.S |
3000 | 3000 | 0 |
89 |
Jerry |
555.1111 |
Fine Arts |
89 |
Jerry.S |
2500 | 2500 | 0 |
99 ½ |
Kramer |
555.1111 |
Space |
99 ½ |
Cosmo.Kramer |
3600 | 5.75 | 3594.25 |
123 |
George |
555.5959 |
Undeclared |
123 |
George.C |
3000 | 0 | 3000 |
119 |
Elaine |
555.9876 |
Business |
119 |
Elaine.B |
2800 | 2000 | 800 |
200 |
Doug |
111.2231 |
Forestry |
200 |
Doug.C |
4000 | 2200 | 1800 |
Many-to-One
primary key = Program
secondary key = Department
Destination Table |
M : 1 |
(Outside) Source Table |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Table 1: Student Contact Data
|
Table 3: Departments
|
After joining it looks like this...
Student ID |
Name |
Phone |
Program |
Department |
# of Faculty |
Student Capacity |
Students Enrolled |
39 |
John |
321.1234 |
Music |
Music |
7 |
122 | 120 |
45 |
Paul |
321.2345 |
Music |
Music |
7 |
122 | 120 |
56 |
George |
321.3456 |
Music |
Music |
7 |
122 | 120 |
88 |
Ringo |
321.4567 |
Music |
Music |
7 |
122 | 120 |
89 |
Jerry |
555.1111 |
Arts |
Arts |
39 |
2800 | 2654 |
99 ½ |
Kramer |
555.1111 |
Space |
|
|||
123 |
George |
555.5959 |
Undeclared |
|
|||
119 |
Elaine |
555.9876 |
Business |
Business |
8 |
120 | 109 |
200 |
Doug |
111.2231 |
Forestry |
Forestry |
6 |
46 | 39 |
One-to-Many
primary key = Name
secondary key = Winner
Destination Table |
1 : M |
(Outside) Source Table |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
Table 1: Student Contact Data
|
Table 4: Scholarships
|
After relating (and selecting Paul) it looks like this...
Destination Table |
1 : M |
(Outside) Source Table |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
Table 1: Student Contact Data
|
Table 4: Scholarships
|