Anda di halaman 1dari 10

1a.

Entities, Attributes and Primary key discovered for Hospital Management System

Patient, Employee, Doctor, Nurse, Receptionist, Rooms, Records

Patient: PID, Name, Address, Age, Sex, Details, Contactno (Primary key:PID)

Employee:EID,Name,Address,Age,LicenseNo,dateofjoining,Contactno,Experience,Salary
(Primary key:PID)

Rooms: Roomid, Roomtype, Period, Roomrate (Primary key: Roomid)

Records: Recordno, PID, EID, Appointmentdate, Details (Primary key: Recordno)

1b.)

Employee, Doctor is the Super Type Entity

Doctor, Admin, Nurse are the sub type Entity .Doctor is subtype entity because it comes under
Employee but it is also Super entity as it contains Trainee and permanent as sub entities.

1c.)

Nurse is a weak entity

1d.)

Name and Contact no both are multivalued attributes in patient and employee entity as name
consists of first name ,last name and contactno may consists of mobile or landline no.

1e.)

Patient Assigned Room, Patient attends doctor are the 1:1 relationship found.

1f.)

Receptionist maintains a record is example of 1:M relationship.

1g.)

Nurses governs rooms .N:M relationship as multiple rooms are handled by multiple persons.
1h.)

Ternary Relationship for the scenario

Doctor

Permament IS Trainee
A

1i.)

Complete ER Diagram
Date Admitted

Admitted
Date Discharge
Age contact No
Details Roomtype
Sex Roomrate
Address
Date
Name Governs
Period

PID Patient Dtof joining


Assigned Rooms
Nurse
Salary

RoomID contact No

License
Employee
no

Age
EID
attends

Address
IS A
Name

Doctor Reception

Maintains
Temporary IS A Permanent

Details

Appntdate

Records
EID

PID
Recordno
2.i) ..viii)

The eight steps algorithm required to convert an EERD into set of relations

1. Map Regular Entity Types: for each entity type we have to create a relation that
contains only single value attributes. We have to declare primary key to uniquely
identify the other attributes.
2. Map Weak Entity Types: for each weak entity type we have to create a relation that
contains only single value attributes and also define the foreign key.
3. Map 1:1 Relationship: Apply foreign key, merged relationships, cross-reference
approach to identify all the 1:1relatioship
4. Map 1:N Relationship: Identify the relationship schema that represent entity type at
N side of 1:N relationship
5. Map N:M Relationship: for every N:M relationship or ternary or of any higher
order type create a new relation.
6. Map Multivalued Attributes: create a new relation to hold multivalued attributes.
7. Specializations
8. Mapping Union types (Generalization).

Patient

PID Name Address Sex Age Details Contact No


Multivalued

Employee

EID Name Address Age LicenseNo Dateofjoining Contactno Experience Salary

Room

RoomId Roomtype period Roomrate PID

Records

Recordno PID EID Appointmentdate Details


3.

Data Dictionary for the above ER Diagram

Patient:

Attribute Data Type Size Primary Foreign Key Details


Key
PID Int 5 Yes - Patient id
Name varchar 100 - -
Address varchar 200 - -
Age Int 5 - -
Sex Char 1 - - M or F
Details varchar 200 - -
Contactno Int 8 - -
Employee:

Attribute Data Type Size Primary Key Foreign Key Details


EID Int 5 Yes - Employee id
Name varchar 100 - -
Address varchar 200 - -
Age Int 5 - -
LicenseNo Int 10 - -
Dateofjoining Date - -
Contactno Int - -
Experience Int 50 - -
Salary float 10 - -
Room:

Attribute Data Type Size Primary Foreign Key Details


Key
RoomID Int 10 Yes -
Roomtype varchar 50 - -
Period Int 5 - -
Roomrate float 5 - -
Record:

Attribute Data Size Primary Foreign Key Details


Type Key
Recordno Int 10 - -
PID Int 10 - -
EID Int 10 - -
Appointmentdate date 10 - -
Details Varchar 200 - -
4a)

UN Normalized Relation for Smart Construction Company


Branch Location Department Contactno ContractorID Cname Clocation Ccontactno QuationNo Tenderno Lastdate Amount
B1 Doha Sales 44135678 c1 Al Jaber Doha 77453267 1 101 02/03/2015 10000
B1 Doha Purchase 44135679 c2 QBC Dubai 77453288 2 102 04/03/2015 55000
B1 Doha Finance 44135680 c2 QBC Dubai 77453288 3 103 07/03/2015 45000
B1 Doha Sales 44135681 c2 QBC Dubai 77453288 4 104 09/03/2015 76000
B2 Dubai Sales 44135682 c1 Al Jaber Doha 77453267 5 105 12/03/2015 92000
B2 Dubai Sales 44135683 c1 Al Jaber Doha 77453267 6 106 14/03/2015 74000
B2 Dubai Finance 44135684 c1 Al Jaber Dubai 77453267 7 107 18/03/2015 66000
B3 Sharjah Finance 44135685 c3 Nasco Sharjah 77453299 8 108 21/03/2015 85000
B3 Sharjah Finance 44135686 c3 Nasco Sharjah 77453299 9 109 23/03/2015 44000
B3 Sharjah Purchase 44135687 c3 Nasco Sharjah 77453299 10 110 25/03/2015 99000
b)

Primary keys

Branch

Contractor ID

Quotationno

c)

Functional dependencies in the un-normalized relation are:

Branch--> {Location, Department, ContactNo}

ContractorID-->{Contractor,CLocation, Contactno, Quotationno }

Quotationno-->{Tenderno,lastdate,Amountpen}

d)

BCNF (Boyce Cod normal form Relation)

Branch

Branch Location Department ContactNo


C1 Doha Sales, purchase, finance 44135678
C2 Dubai Sales, Finance 44135682
C3 Sharjah Sales, purchase, finance 70306720

Contractordetails

ContractorID Contractor Clocation CContactNo


C1 Al Jaber Doha 61324568
C2 QBC Dubai 77453267
C3 Nasco Sharjah 44678912
Quotationdetails

Quotationno Branch Location ContractorID Lastdate Amount


3001 1 1001 15/02/2015
3002 2 1002 25/04/2015
3003 3 1001 15/12/2014
3004 4 1001 15/02/2015
3005 5 1002 25/04/2015
3006 3 1003 15/12/2014
3007 4 1004 15/02/2015
3008 5 1005 25/04/2015
3009 1 1001 15/12/2014
3010 2 1004 15/02/2015

5.)

ER (Entity relationship) Diagram also known as Top down approach of designing the database.
It is the graphical representation of different components entities, attributes and the relationship
among them. It uses different notations to represent the entity, attributes and relationship. It is
widely used in creating database design for complex data. It does not follow any standard
procedure for developing the design but it helps us to explore each component briefly.

Normalization also known as the bottom up approach is most common approach used by
professionals in database designing. Using different levels of normal forms (1NF, 2NF, 3NF,
4NF, 5 NF) we are able to remove the redundancies and find out the dependencies between
various relations. At each level of normalization we break the relation into sub relations in order
to remove the repetition of records in the relation (generalization)

Comparison between the two approaches

Sno. Top Down Bottom Up


1. Graphical representation Actual data in form of un-normalized
relation
2. Simple and easy to understand Complex
3. Prior knowledge not required Prior knowledge required
4. Repetition may be there Repetition is fully removed
5. No standard for developing ER diagram Systematic way to normalize relation
6. Less focus on dependencies Focuses on data dependencies

Top down approach is simple and easy to understand but from professional and systematic point
of view I will prefer using bottom up approach .As we have actual data in bottom up approach it
becomes easier to find out the dependencies between the two relations.
Bibliography

http://www.tutorialspoint.com/dbms/er_diagram_representation.htm

http://www.studytonight.com/dbms/er-diagram.php

http://www.studytonight.com/dbms/database-normalization

https://www.cs.oberlin.edu/~jdonalds/311/lecture11.html

http://www.slideshare.net/ARADHYAYANA/er-diagram-to-relational-schema-mapping

http://www.learndb.com/databases/how-to-convert-er-diagram-to-relational-database
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

Anda mungkin juga menyukai