1a.
List of Entities, attributes and primary key are:
Entity Attributes Primary
Key
Patient Pid,Pname,Paddress,Psex,Page,Pcontactno,Pappointmentdate Pid
Pdisease, DoctorRefid
Employee Eid,Ename,Eaddress,Esex,Eage,Econtactno,Ejoiningdate Eid
Edesignation,ELicenseNo
Doctor Sub Entity
Nurse Sub Entity
Admin Sub Entity
Room Rid,Rtype,Rrate,Pid,Rextension Rid
Records/Invoice Invoiceno,Pid,Noofdays,Lid,DoctorRefid,Amount Invoiceno
Lab Report Labid,Reportno,Pid,Details Labid
Inpatient Pid,date,DoctorRefid,Details
Outpatient Pid,Labreportno,details,date
1b.)
Super Entity: Employee
Sub-Entity: Doctor, Admin,Nurse
1c.)
InPateient And OutPatient both acts as the weak entity as their existence depends upon the
labreport entity
1d.)
In Patient and Employee Entity, Pcontactno and Econtactno represents multi-value attribute as it
can have multiple values for the contact no.
1e.)
Patient Consults Doctor is a 1:1 relationship. One Patient consults one doctor at a time.
1f.)
Doctor Reviews LabReport 1:M relationship. Doctor reviews multiple reports of the same
patient.
1g.)
LabReport decides Inpatient and outpatient act as N:M relationship as multiple reports belong to
one or more patient.
1h.)
Ternary Relaionship
Lab Report
Outpatient Decides Inpatient
1i.)
ER Diagram
Pcontact No
Page
Psex
PappoinmentDate
Paddress Date
Date Admitted
Pname
Admitted
Date Discharge
Pid Patient
Consults Visits
Registers
Doctor
Eage SPH Econtact No
Esex Ejoiningdate
has
Date
Eaddress
Edesignation
Employee
Ename Admitted Admin
ELicenseno
Review Eid
IS A
s Maintains
ReportNo Nurse
Pid
Lab Report
InvoiceNo
Details
Outpatient
date Controls
Decides
Labreportno DoctorRefid
detail Date Inpatient Details
Lid Amount
Pid
Pid Noofdays
Admitted Record/Invoice
Extension
Room Pid
Pid DoctorRefid
Rid InvoiceNo
Rtype Rrate
Issued
2.i) ..viii)
The Steps to Covert EERD into a relational Model are as Follows:
Map Regular Entity Types
Map Weak Entity Types
Map 1:1 Relationship Types
Map 1:N Relationship Types
Map N:M Relationship Types
Map Multivalued Attributes
Map Specializations
Map Unions
Patient
Pid Pname Paddress Psex Page Pcontactno Pappointmentdate Pdisease Doctorrefid
Employee
Eid Ename Eaddress Esex Eage Econtactno Ejoiningdate Edesignation Elicenseno
Room
Rid Rtype Rrate Pid Rextension
Records/Invoice
Invoiceno Pid NoofDays Labid Doctorrefid Amount
LabReport
Labid Reportno Pid Details
Inpatient
Pid Date Doctorrefid Details
Outpatient
Pid Date Labreportno Details
3.
Data Dictionary for the SPH ER- Diagram
Patient
Attribute Data Type Size Primary Key Foreign Key
Pid Int 5 Y N
Pname character 255 N N
Paddress character 255 N N
Psex character 1 N N
Page Int 5 N N
Pcontactno Int 8 N N
Pappointment Datetime N N
Date
Pdisease character 500 N N
Doctorrefid Int N Y(Employee Eid)
Employee
Attribute Data Type Size Primary Key Foreign Key
Eid Int 5 Y N
Ename character 255 N N
Eaddress character 255 N N
Esex character 1 N N
Eage Int 5 N N
Econtactno Int 8 N N
Ejoining Date Datetime N N
Edesignation character 50 N N
Elicenseno Int 10 N N
Room
Attribute Data Type Size Primary Foreign Key
Key
Rid Int 10 Y N
Rtype character 255 N N
Rrate Int 255 N N
Pid Int 5 N Y Patients(Pid)
Rextension Int 8 N N
Record/Invoice
Attribute Data Type Size Primary Key Foreign Key
Invoiceno Int 10 Y N
Pid Int 10 N N
Noofdays Int 10 N N
Labid Int 10 N Y LabReport(Labid)
Doctorrefid Int 10 N N
Amount Float 10 N N
LabReport
Attribute Data Type Size Primary Key Foreign Key
Labid Int 10 Y N
Reportno Int 10 N N
Pid Int 10 N YPatient(Pid)
Details character 500 N N
InPatient
Attribute Data Type Size Primary Foreign Key
Key
Pid Int 10 Y Y Patient(Pid)
Date datetime N N
Doctorrefid Int 10 N YEmployee(Eid)
Details character 500 N N
OutPatient
Attribute Data Type Size Primary Foreign Key
Key
Pid Int 10 Y Y Patient(Pid)
Date datetime N N
Reportno Int 10 N Y LabReport (Reportno)
Details character 500 N N
4a)
UN Normalized Relation
Branch_ID B_Location B_Dept B_Head ContactNo Contractor_ID Contractor C_location C_ContactNo Tender_ID Job_ID T_open T_Close Amount
1 Al Khor Sales Mohammed 44135678 1001 Urbacon Al Khor 61324568 3001 1 15/02/2015 15/03/2015
150,000.0
2 Doha Finance Ali 44556681 1002 Rasgas Doha 77453267 3002 2 25/04/2015 25/05/2015
650,000.0
3 Saniyya Lease Hamza 70306720 1001 Urbacon Al Khor 61324568 3003 3 15/12/2014 15/1/2015
659,000.0
4 Jumerah Safety Abdullah 55321112 1001 Urbacon Al Khor 61324568 3004 4 15/02/2015 15/03/2015
235,500.0
5 Riyadh HR Nayab 77117242 1002 Rasgas Doha 77453267 3005 5 25/04/2015 25/05/2015
76,000.00
3 Saniyya Lease Hamza 70306720 1003 Qapco Riyadh 44678912 3006 6 15/12/2014 15/1/2015
556,777.0
4 Jumerah Safety Abdullah 55321112 1004 GBC Doha 77453267 3007 7 15/02/2015 15/03/2015
45,600.00
5 Riyadh HR Nayab 77117242 1005 Gulf Const Rayan 44678912 3008 8 25/04/2015 25/05/2015
63,000.00
1 Al Khor Sales Mohammed 44135678 1001 Urbacon Al Khor 61324568 3009 9 15/12/2014 15/1/2015
88,990.00
2 Doha Finance Ali 44556681 1004 GBC Doha 77453267 3010 10 15/02/2015 15/03/2015
99,000.00
b)
Primary keys that will help us to uniquely identify the relations
Branch_ID
Contractor_ID
Tender_ID
c)
Functional dependencies in the un-normalized relation are:
Branch_ID--> {B_Location, B_Dept,B_ContactNo,B_Head}
Contractor_ID-->{Contractor,C_Location,C_Contactno,Job_ID}
Tender_ID-->{Tender_ID,Job_ID,T_Open,T_Close}
d)
BCNF Relation
Branchdetails
Branch_ID B_Location B_Dept B_Head ContactNo
1 Al Khor Sales Mohammed 44135678
2 Doha Finance Ali 44556681
3 Saniyya Lease Hamza 70306720
4 Jumerah Safety Abdullah 55321112
5 Riyadh HR Nayab 77117242
Contractordetails
Contractor_ID Contractor C_location C_ContactNo
1001 Urbacon Al Khor 61324568
1002 Rasgas Doha 77453267
1003 Qapco Riyadh 44678912
1004 GBC Doha 77453267
1005 Gulf Const Rayan 44678912
Tender_details
Tender_ID Branch_ID Contractor_ID Job_ID T_open T_Close Amount
3001 1 1001 1 15/02/2015 15/03/2015
150,000.00
3002 2 1002 2 25/04/2015 25/05/2015
650,000.00
3003 3 1001 3 15/12/2014 15/1/2015
659,000.00
3004 4 1001 4 15/02/2015 15/03/2015
235,500.00
3005 5 1002 5 25/04/2015 25/05/2015
76,000.00
3006 3 1003 6 15/12/2014 15/1/2015
556,777.00
3007 4 1004 7 15/02/2015 15/03/2015
45,600.00
3008 5 1005 8 25/04/2015 25/05/2015
63,000.00
3009 1 1001 9 15/12/2014 15/1/2015
88,990.00
3010 2 1004 10 15/02/2015 15/03/2015
99,000.00
5.)
ER Modelling (Top down Approach): it is the graphical technique for understanding and
organizing the data without its actual implementation. It is used for developing commercial
database applications containing complex data.
Pros
1. It is simple and easy to understand. Users without prior knowledge can also easily
understand.
2. It can be easily generalized and specialized based upon the requirements.
3. A high level data system can be designed using this approach
Cons
1. It doesnt follow any specific standard for developing the ER diagrams.
2. Inconsistency or the repetition might occur.
Normalization (Bottom up Approach): It is the most commonly followed approach in database
design. We are able to find out the exact dependencies of one entity over another. In bottom up
approach we remove the redundancy, inconsistency from the data level by level by moving from
one normal form to another.
Pros
1. Prcised and systematic approach.
2. It helps to synthesize the relational schemas
3. It focuses on the use of data dependency.
Cons
1. Proper knowledge is required before we start.
2. Complex as we have to focus on all the relations.
From the beginner point of view I would prefer Top down approach as its simple and easy to
understand. Moreover the graphical representation makes it easier to add or remove the
requirements at any time.
Bibliography
https://cs.uwaterloo.ca/~david/cs338/12%20ER%20to%20Rel.pdf
http://holowczak.com/converting-e-r-models-to-relational-models/
http://www.cs.ust.hk/~wilfred/Bobby/public_html/report/node37.html#SECTION008310000000
00000000
http://www.careerbless.com/db/rdbms/Overview.php
Bibliography
http://creately.com/blog/diagrams/er-diagrams-tutorial/
http://www.studytonight.com/dbms/database-normalization.php
http://www.tutorialspoint.com/dbms/database_normalization.htm
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.296.6945&rep=rep1&type=pdf
http://www.tutorialspoint.com/dbms/er_model_basic_concepts.htm