week 2 lab2 er diagram dina a. said [email protected]

9
Week 2 Lab2 ER Diagram Dina A. Said [email protected]

Upload: phillip-adams

Post on 13-Dec-2015

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Week 2 Lab2 ER Diagram Dina A. Said dasaid@ucalgary.ca

Week 2 Lab2ER DiagramDina A. Said

[email protected]

Page 2: Week 2 Lab2 ER Diagram Dina A. Said dasaid@ucalgary.ca

Entity-Relations (ER) Diagram illustrates the interrelationships between entities in a database.

4/08/2009 CPSC203-DesignSkills- Week2- Lab2 2

Product-Product ID-Product Name-Description

-Supplier-Supplier ID-Supplier Name-Phone-Address

Orders-Product ID-Supplier ID-Shipment Date-Quantity-Price per unit

Page 3: Week 2 Lab2 ER Diagram Dina A. Said dasaid@ucalgary.ca

Example: DVD rental Store System

4/08/2009 CPSC203-DesignSkills- Week2- Lab2 3

Page 4: Week 2 Lab2 ER Diagram Dina A. Said dasaid@ucalgary.ca

Case Study Consider an appointment system in a clinic, where a patient can request to make an

appointment to see a certain doctor at a specific time. Additionally, a doctor can use that system to record the timings where he would be available to see his patients.

Upon reserving an appointment, the receptionist has to make sure that the doctor speaks a language that the patient knows.

If the patient requests a specific device to be in the clinic, the receptionist should make sure that this device is available in the clinic to be reserved

Also, the receptionist should print information of the reserved appointment including the date, time, and clinic location

4/08/2009 CPSC203-DesignSkills- Week2- Lab2 4

Page 5: Week 2 Lab2 ER Diagram Dina A. Said dasaid@ucalgary.ca

4/08/2009 CPSC203-DesignSkills- Week2- Lab2 5

Patients-Patient ID-Name-Address-Phone-Sex-Birth Date-Language ID

Doctors-Doctor ID-Name-Address-Phone-Sex-Birth Date-Certificates-Specialist-Salary-Language ID

Language-Language ID-Language

Available Times-Doctor ID-Date-Start Time-End Time

Appointments-Patient ID-Doctor ID-Date-Start time-End time-Charges-Paid/Not Paid-Clinic ID

Clinics-Clinic ID-Location-Available Devices

Page 6: Week 2 Lab2 ER Diagram Dina A. Said dasaid@ucalgary.ca

4/08/2009 CPSC203-DesignSkills- Week2- Lab2 6

Clinics-Clinic ID-Location-Available Devices

Clinics-Clinic ID-Location

Devices-Device ID-Device Name-Description-Clinic ID

This is because every device exists in only one clinic but clinics may have multiple devices

Page 7: Week 2 Lab2 ER Diagram Dina A. Said dasaid@ucalgary.ca

What if the doctor speaks more than one language?

4/08/2009 CPSC203-DesignSkills- Week2- Lab2 7

Doctors-Doctor ID-Name-Address-Phone-Sex-Birth Date-Certificates-Specialist-Salary-Language ID

Language-Language ID-Language

Page 8: Week 2 Lab2 ER Diagram Dina A. Said dasaid@ucalgary.ca

4/08/2009 CPSC203-DesignSkills- Week2- Lab2 8

Doctors-Doctor ID-Name-Address-Phone-Sex-Birth Date-Certificates-Specialist-Salary

Language-Language ID-Language

Doctor-Language-Doctor ID-Language ID

This called many to many relationships

Page 9: Week 2 Lab2 ER Diagram Dina A. Said dasaid@ucalgary.ca

ExerciseConstruct an ER Diagram for an online travel agency system. A new user is required to create a new profile with a username and password. After logging in the system, the user inquires about different flights. The user can perform booking, changing, and canceling flight reservations.

Tips:- You have three main tables; users, flights, and booked-flight- Think what information should be included in each table and what the

relationships among them should be- Expand your ER diagram to contain information about planes, airlines, and

preferred meals

4/08/2009 CPSC203-DesignSkills- Week2- Lab2 9