Presentation is loading. Please wait.

Presentation is loading. Please wait.

Project – Phase II Derive Database Schema from E-R Model DBDL.

Similar presentations


Presentation on theme: "Project – Phase II Derive Database Schema from E-R Model DBDL."— Presentation transcript:

1 Project – Phase II Derive Database Schema from E-R Model DBDL

2 E-R Model to DBDL Entity Type  Table Composite: Use individual fields Multi-Value: Separate table Relationship Type  Table or No Table Many-to-Many: Separate table One-to-Many: No new table Copy PK as FK (one direction) One-to-One: No new table Copy PK as FK (either direction)

3 Multi-Value Attributes Staff staffNo... qualifications: Composite (…) : Multi-Value wkExp: Composite (…) : Multi-Value... Tables: Staff Qualification WorkExperience

4 Many-to-Many Relationship Supply (1..*) Has (1..*) Supplier One supply can come from multiple suppliers One supplier can provide multiple supplies Tables: Supply Supplier SupplyFromSupplier

5 Foreign Keys Primary key of another table Medication (patNo, fName, lName, wardNo, drugNo, drugName, unitsPerDay, adminMethod, startDate, finishDate, staffNo) Primary Key: patNo, drugNo, startDate Alternate Key: patNo, drugNo, finishDate Foreign Key : patNo references Patient wardNo references Ward staffNo references Staff. drugNo references Pharmaceutical

6 Foreign Keys Appointment (1..*) GettingInfoFrom (1) LocalDoctor Appointment (apptNo, patNo, firstName, lastName, consultantNo, date, time, room, comment, docNo, clinicNo, clinicPhone) Primary Key: apptNo Alternate Key: consultantNo, date, time patNo, date, time Foreign Key : consultantNo references Staff(staffNo) patNo references Patient docNo references LocalDoctor

7 Foreign Keys InPatient (0..1) Has (1) Appointment InPatient (patNo, patName, dateOnWaitList, wardReq, expectedStay, dateInWard, actDateDepart, bedNo, examApt) Primary Key: patNo, dateOnWaitList Alternate Key: none Foreign Key : patNo references Patient wardReq references Ward(wardNo) examApt references Appointment(apptNo)

8 Foreign Keys OutPatient (0..1) Has (1) Appointment OutPatient (patNo, fName, lName, address, phone, DOB, gender, appDate, appTime, examApt) Primary Key: patNo, appDate Alternate Key: none Foreign Key : patNo references Patient examApt references Appointment(apptNo)

9 Project – Phase III Normalization Notes: 14 – 18 Assignment 5, 6 Test 1 DBDL for final tables in BCNF.

10 Quiz 3 10

11 Comparing Dates Insert into booking Values('H01', 'G01011', SysDate, SysDate + 2, 'R103'); Select * From Booking Where Date_From = SysDate; -- no rows selected

12 Comparing Dates Insert into booking Values('H01', 'G01011', SysDate, SysDate + 2, 'R103'); Select * From Booking Where Date_From = SysDate; Select * From Booking Where to_char(Date_From, 'dd mm yyyy') = to_char(SysDate, 'dd mm yyyy'); -- one row selected -- Date has time inside!

13 Schedule Phase III Wednesday, May 1 Quiz 4 Wednesday, May 1 Test 2 Wednesday May 8 Final Exam Thursday, May 16, at 7 PM 13

14 Lab 10 14


Download ppt "Project – Phase II Derive Database Schema from E-R Model DBDL."

Similar presentations


Ads by Google