Presentation is loading. Please wait.

Presentation is loading. Please wait.

Entity-Relationship Modeling (ER-M)

Similar presentations


Presentation on theme: "Entity-Relationship Modeling (ER-M)"— Presentation transcript:

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

2 1. 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 1b) break down M:N into two 1:M
S_ID S_Name S_Major C_ID C_Title C_Credits Advisor Ad_ID Ad_Name Ad_Department Student Course 1b) break down M:N into two 1:M S_ID S_Name S_Major C_ID C_Title C_Credits Ad_ID Ad_Name Ad_Department Advisor Student Course Student_Advisor Ad_ID S_ID Semester Year Enrollment C_ID S_ID

4 2. 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 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 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 2 b) step -2 break down M:N into two 1:M

6 3. 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 3 a) 3 b) break down M:N into two 1:M Physician Physician_ID Specialty
Patient_ID Pat_Name Patient Treats Admits 3 a) 3 b) break down M:N into two 1:M 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)


Download ppt "Entity-Relationship Modeling (ER-M)"

Similar presentations


Ads by Google