Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "1-1 CHAPTER 5 DATABASES CHAPTER 5 DATABASES Jason C. H. Chen, Ph.D. Professor of MIS School of Business Administration Gonzaga University Spokane, WA 99258."— Presentation transcript:

1 1-1 CHAPTER 5 DATABASES CHAPTER 5 DATABASES Jason C. H. Chen, Ph.D. Professor of MIS School of Business Administration Gonzaga University Spokane, WA Entity-Relationship Modeling (ER-M)

2 Data Modeling (Student-Advisor) Each semester, each student must be assigned an adviser who counsels students about degree requirements, and helps students register for classes. Each student must register for chasses with the help of an adviser, but if the students’ assigned adviser is not available, the student may register with any adviser. We must keep track of students, the assigned adviser for each, and the name of the adviser with whom the student registered for the current term (therefore, there is a relationship between “Student” and “Course”). Represent this situation of students, advisers and course with an E-R diagram. Also, draw a data model for this situation using the tool you have been told to use in your course. – Entity and attributes – Relationship and cardinality

3 1-3 S_ID S_Name S_Major C_ID C_Title C_Credits Advisor Ad_ID Ad_Name Ad_Department StudentCourse S_ID S_Name S_Major C_ID C_Title C_Credits Ad_ID Ad_Name Ad_Department AdvisorStudentCourse Student_Advisor Ad_ID S_ID Semester Year Enrollment C_ID S_ID Semester Year 1a) 1b) break down M:N into two 1:M

4 Data Modeling (Project – Employee) A company has a number of employees. The attributes of EMPLOYEE include Employee_ID (identifier), Name Address and Birthdate. The company also has many projects with Project_Name and Start_Date, Expected finish date, and Budget. Each employee may be assigned to one or more projects, or may not be assigned to a project. A project must have at least one employee assigned and may have any number of employees assigned. An employee’s billing rate for a project may vary by project and the company wishes to record the applicable billing rate (Billing_Rate) for each employee when assigned to a particular project. A client normally asks the company working more than one project for them. The attributes of CLIENT includes Client_ID, Name, Address, Contact, Title and Phone. – Entity and attributes – Relationship and cardinality

5 1-5 Employee Emp_ID Name Address DOB Project Proj_ID Proj_Name Start_Date Exp_Fin_Date Budget Client Client_ID Name Address Contact Title Phone 2 a) step-1 2 b) step -2 break down M:N into two 1:M Employee Emp_ID Name Address DOB Project Proj_ID Proj_Name Start_Date Exp_Fin_Date Budget Client Client_ID Name Address Contact Title Phone Billing (or Project_Employee) Emp_ID Proj_ID Billing Rate

6 Data Modeling (Physician) A hospital has a large number of registered physicians, Attributes of Physician include Physician_ID (the identifier) and Specialty. Patients are admitted to the hospital by physicians. Attributes of Patient include Patient_ID (the identifier) and Patient_Name. Any patient who is admitted must have exactly one admitting physician. A physician may optionally admit any number of patients. Once admitted, a given patient must be treated by at least by a physician. A particular physician may treat any number of patients, or may not treat any patients. Whenever a patient is treated by a physician, the hospital wishes to record the details of the treatment (Treatment_Detail). Components of Treatment_Detail include Date, Time, and Results. Did you draw more than on e relationship between physician and patient? Why or why not? – Entity and attributes – Relationship and cardinality

7 1-7 Physician Physician_ID Specialty Patient_ID Pat_Name Patient Treats Admits Physician Physician_ID Specialty Patient_ID Patient_Name Patient Physician_ID Patient_ID Treatment_Detail or (Physican_Patient) Date Time Results Admits *Note that the “KEY” to Treatment_Detail can be: Pat_ID and Phys_ID (CK) 3 a) 3 b) break down M:N into two 1:M


Download ppt "1-1 CHAPTER 5 DATABASES CHAPTER 5 DATABASES Jason C. H. Chen, Ph.D. Professor of MIS School of Business Administration Gonzaga University Spokane, WA 99258."

Similar presentations


Ads by Google