Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 5 STUDENT-COURSE

Similar presentations


Presentation on theme: "Chapter 5 STUDENT-COURSE"— Presentation transcript:

1 Chapter 5 STUDENT-COURSE
Jason C. H. Chen, Ph.D. Professor of MIS School of Business Administration Gonzaga University Spokane, WA 99258

2 STUDENT and COURSE Entities
Student_id Name Address Major pk COURSE Course_id Title Instructor_id pk M Q1. One STUDENT normally takes ____ COURSE? M Q2. One COURSE normally is taken by ___ STUDENT

3 STUDENT, COURSE and INSTRUCTOR Entities
Student_id Name Address Major pk COURSE Course_id Title Instructor_id pk fk Q3. One INSTRUCOTR normally teaches ____ COURSE? M Q4. One COURSE normally is taught by ___ INSTRUCOTR 1 INSTRUCTOR Instructor_id Instructor_Name Office pk fk pk With fk, we will be able to know a course was taught by ‘whom/?

4 STUDENT, COURSE and INSTRUCTOR Entities
Student_id Name Address Major COURSE Course_id Title Instructor_id teaches INSTRUCTOR Instructor_id Instructor_Name Office

5 STUDENT, COURSE and INSTRUCTOR Entities
Student_id Name Address Major pk COURSE Course_id Title Instructor_id pk fk We can’t do any implementation on M:N relationship. Why? INSTRUCTOR Instructor_id Instructor_Name Office We will study why and how to solve this problem. We, therefore, focus on the M:N relationship. i.e., STUDENT and COURSE pk

6 STUDENT and COURSE Entities
Student_id Name Address Major pk pk COURSE Course_id Title Instructor_id M Q1. One STUDENT normally takes ____ COURSE? M Q2. One COURSE normally is taken by ___ STUDENT

7 STUDENT and COURSE Entities
Student_id Name Address Major COURSE Course_id Title Instructor_id Q. John Smith (121) is taking five courses in Spring 2017 can John’s enrollment data (see below) be inserted in the above model (M:N)? (Y/N)? No ___ room to place these five courses for John (either in STUDENT or COURSE). How to solve this issue?

8 STUDENT and COURSE Entities
Student_id Name Address Major COURSE Course_id Title Instructor_id Q. John Smith (121) is taking five courses in Spring 2017 can John’s enrollment data (see below) be inserted in the above model (M:N)?

9 STUDENT and COURSE Entities
Student_id Name Address Major COURSE Course_id Title Instructor_id

10 STUDENT, COURSE and ENROLLMENT Entities
Student_id Name Address Major pk pk COURSE Course_id Title Instructor_id Was registered Register-for cpk (composite key) ENROLLMENT Student_id Course_id Grade Semester Year One Two General Rule: ____ M:N relationship will be broken down into _____ 1:M relationships.

11 A Revised E-R model A student may take two or more course.
A course is taken by two or more students.

12 What are the foreign key (fk)?
A Revised E-R model STUDENT Student_id Name Address Major COURSE Course_id Title Instructor_id pk pk was registered fk fk Register-for cpk (composite key) ENROLLMENT Student_id Course_id Grade Semester Year teaches INSTRUCTOR Instructor_id Instructor_Name Office pk What are the foreign key (fk)?

13 2nd set To be revised for faculty and student

14 FACULTY and STUDENT Entities
faculty_id Title Office Phone STUDENT Student_id Name Address Major M Q1. One FACULTY normally teaches ____ STUDENT? M Q2. One STUDENT normally is taughts by ___ FACULTY

15 FACULTY and STUDENT Entities
faculty_id Title Office Phone STUDENT Student_id Name Address Major Q. Dr. Jason Chen (331) is teaching fifteen students in Spring 2017 can his teaching data (see below) be inserted in the above model (M:N)? (Y/N)?

16 FACULTY and STUDENT Entities
faculty_id Title Office Phone STUDENT Student_id Name Address Major Q. Dr. Jason Chen (331) is teaching fifteen students in Spring 2017 can his teaching data (see below) be inserted in the above model (M:N)? (Y/N)? No room to place these fifteen students for Dr. Chen (either in FACULTY or STUDENT). How to solve this issue?

17 FACULTY and STUDENT Entities
faculty_id Title Office Phone STUDENT Student_id Name Address Major

18 FACULTY and STUDENT Entities
faculty_id Title Office Phone STUDENT Student_id Name Address Major

19 STUDENT, COURSE and ENROLLMENT Entities
FACULTY faculty_id Title Office Phone STUDENT Student_id Name Address Major pk pk Was taught Teaching cpk (composite key) TEACHING_DATA Faculty_id Student_id Course_id Semester Year One Two General Rule: ____ M:N relationship will be broken down into _____ 1:M relationships.

20

21 A Revised E-R model A student may take two or more course.
A course is taken by two or more students.

22 What are the foreign key (fk)?
A Revised E-R model STUDENT Student_id Name Address Major COURSE Course_id Title Instructor_id pk pk was registered fk Register-for cpk (composite key) ENROLLMENT Student_id Course_id Grade Semester Year teaches INSTRUCTOR Instructor_id Instructor_Name Office pk What are the foreign key (fk)?

23

24 #10 NOTE: The addition of Semester and Year attributes on the Registers_for relationship allows this diagram (and resulting database) to reflect multiple semesters of data.

25 STUDENT and COURSE Entities
Student_id Name Address Major COURSE Course_id Title Instructor_id M Q1. One STUDENT normally takes ____ COURSE? M Q2. One COURSE normally is taken by ___ STUDENT

26 STUDENT and COURSE Entities
Student_id Name Address Major COURSE Course_id Title Instructor_id teaches INSTRUCTOR Instructor_id Instructor_Name Office

27 STUDENT and COURSE Entities
Student_id Name Address Major COURSE Course_id Title Instructor_id teaches INSTRUCTOR Instructor_id Instructor_Name Office

28 STUDENT and COURSE Entities
Student_id Name Address Major COURSE Course_id Title Instructor_id

29 STUDENT and COURSE Entities
Student_id Name Address Major COURSE Course_id Title Instructor_id teaches INSTRUCTOR Instructor_id Instructor_Name Office

30

31 Grade Semester Year STUDENT COURSE INSTRUCTOR Student_id Name
Address Major COURSE Course_id Title Instructor_id Register-for teaches INSTRUCTOR Instructor_id Instructor_Name Office

32 STUDENT COURSE INSTRUCTOR Student_id Name Course_id Address Title
Major COURSE Course_id Title Instructor_id REGISTRATION Student_id Course_id Grade Semester Year teaches INSTRUCTOR Instructor_id Instructor_Name Office

33 STUDENT COURSE INSTRUCTOR Student_id Name Course_id Address Title
Major COURSE Course_id Title Instructor_id was registered Register-for ENROLLMENT Student_id Course_id Grade Semester Year teaches INSTRUCTOR Instructor_id Instructor_Name Office

34

35 STUDENT COURSE INSTRUCTOR Student_id Name Course_id Address Title
Major COURSE Course_id Title Instructor_id was registered Register-for REGISTRATION Student_id Course_id Grade Semester Year teaches INSTRUCTOR Instructor_id Instructor_Name Office

36 STUDENT and COURSE Entities
Student_id Name Address Major COURSE Course_id Title Instructor_id Q. John Smith (121) is taking five courses in Spring 2016 can John’s enrollment data (see below) be inserted in the above model (M:N)?


Download ppt "Chapter 5 STUDENT-COURSE"

Similar presentations


Ads by Google