... | @@ -7,16 +7,22 @@ Their elements are listed as follow: |
... | @@ -7,16 +7,22 @@ Their elements are listed as follow: |
|
- s_selected_course: uses **id** as primary key and **must stay the same as id in s_student**, and stores student_id and course_id at the same time.
|
|
- s_selected_course: uses **id** as primary key and **must stay the same as id in s_student**, and stores student_id and course_id at the same time.
|
|
- s_teacher: uses **id** and **sn** as primary key and stores name, password, clazz_id and photo at the same time.
|
|
- s_teacher: uses **id** and **sn** as primary key and stores name, password, clazz_id and photo at the same time.
|
|
- s_course: uses **id** as primary key and **must stay the same as id in s_teacher**, and stores name, teacher_id, course_date, selected_num, max_num and info at the same time.
|
|
- s_course: uses **id** as primary key and **must stay the same as id in s_teacher**, and stores name, teacher_id, course_date, selected_num, max_num and info at the same time.
|
|
|
|
|
|
|
|
In the following picture, the red part is the primary key.
|
|
![Relationship](uploads/9c2bfd6dc06df7887c6845205e5dcb86/Relationship.png)
|
|
![Relationship](uploads/9c2bfd6dc06df7887c6845205e5dcb86/Relationship.png)
|
|
|
|
|
|
**Sprint4**
|
|
**Sprint4**
|
|
|
|
|
|
At first we set up a new table: s_attendance. (The turquoise part is the new element, the orange part is new primary key, the turquoise relation line is the new relationline)
|
|
At first we set up a new table: s_attendance.
|
|
- s_attendance: uses **id** as primary key, and stores course_id, type, student_id and course_date at the same time. Besides, course_id, course_date and student_id **must relatively stay the same as** id in s_course, course_date in s_course and id in s_student.
|
|
- s_attendance: uses **id** as primary key, and stores course_id, type, student_id and course_date at the same time. Besides, course_id, course_date and student_id **must relatively stay the same as** id in s_course, course_date in s_course and id in s_student.
|
|
|
|
|
|
|
|
In the following picture, the turquoise part is the new element, the orange part is new primary key, the turquoise relation line is the new relationline.
|
|
![Relationship1](uploads/438266a9fc428a9ec9a3b680b450adbe/Relationship1.png)
|
|
![Relationship1](uploads/438266a9fc428a9ec9a3b680b450adbe/Relationship1.png)
|
|
|
|
|
|
Then we make some changes to the database. (The turquoise part is the new element and the turquoise relation line is the new relationline)
|
|
Then we make some changes to the database.
|
|
1. Add the new element date in s_attendance.
|
|
1. Add the new element date in s_attendance.
|
|
2. course_id in s_selected_course must also **stay the same as** id in s_course
|
|
2. course_id in s_selected_course must also **stay the same as** id in s_course
|
|
3. Add the new element count in s_course.
|
|
3. Add the new element count in s_course.
|
|
|
|
|
|
|
|
In the following picture, the turquoise part is the new element and the turquoise relation line is the new relationline.
|
|
![Relationship2](uploads/93bbf3cd173d42cd1cbcbe9e88d56e4a/Relationship2.png) |
|
![Relationship2](uploads/93bbf3cd173d42cd1cbcbe9e88d56e4a/Relationship2.png) |
|
|
|
\ No newline at end of file |