DBMS
DBMS
: 03
Aim: Develop an Entity-Relationship (ER) diagram for the problem definition identified and convert it
into Relational Database.
Theory:
The ER model defines the conceptual view of a database. It works around real-world entities and
the associations among them.
1. Entity:
An entity can be a real-world object that can be easily identifiable. For example, in a school
database, students, teachers, classes, and courses offered can be considered as entities. All these
entities have some attributes or properties that give them their identity.
2. Attributes:
Entities are represented by means of their properties, called attributes. All attributes have values.
For example, a student entity may have name, class, and age as attributes.
There exists a domain or range of values that can be assigned to attributes. For example, a student's
name cannot be a numeric value. It has to be alphabetic. A student's age cannot be negative, etc.
3. Relationships:
Relationships are represented by diamond-shaped box. Name of the relationship is written inside
the diamond-box. All the entities (rectangles) participating in a relationship, are connected to it by
a line.
◦ For each regular (strong) entity type E in the ER schema, create a relation R that
includes all the simple attributes of E.
◦ If the chosen key of E is composite, the set of simple attributes that form it will
together form the primary key of R.
◦ SSN, DNUMBER, and PNUMBER are the primary keys for the relations
EMPLOYEE, DEPARTMENT, and PROJECT as shown.
▪ Foreign Key approach: Choose one of the relations-say S-and include a foreign
key in S the primary key of T. It is better to choose an entity type with total
participation in R in the role of S.
• Example: 1:1 relation MANAGES is mapped by choosing the participating
entity type DEPARTMENT to serve in the role of S, because its participation
in the MANAGES relationship type is total.
▪ Merged relation option: An alternate mapping of a 1:1 relationship type is
possible by merging the two entity types and the relationship into a single
relation. This may be appropriate when both participations are total.
▪ Cross-reference or relationship relation option: The third alternative is to set
up a third relation R for the purpose of cross-referencing the primary keys of the
two relations S and T representing the entity types.
• Step 4: Mapping of Binary 1:N Relationship Types.
◦ For each regular binary 1:N relationship type R, identify the relation S that represent
the participating entity type at the N-side of the relationship type.
◦ Include as foreign key in S the primary key of the relation T that represents the other
entity type participating in R.
◦ Include any simple attributes of the 1:N relation type as attributes of S.
◦ For each n-ary relationship type R, where n>2, create a new relationship S to
represent R.
◦ Include as foreign key attributes in S the primary keys of the relations that represent
the participating entity types.
◦ Also include any simple attributes of the n-ary relationship type (or simple
components of composite attributes) as attributes of S.
◦ This can be mapped to the relation SUPPLY shown in the relational schema, whose
primary key is the combination of the three foreign keys {SNAME, PARTNO,
PROJNAME}
[Write your contents here]
Project Title: HOTEL MANAGEMENT SYSTEM
ER Diagram:
Relational Schema:
Learning Outcomes: Students should have the ability to
LO3.1: Identify an Entity, Attributes, Relationship, Cardinality and Participation in real life
Example.
LO3.2: Outline an ER Diagram for the identified real-life example
LO3.3: Convert ER Diagram into Relational Database
Course Outcomes: Upon completion of the course students will be able to Outline ER and EER
diagram for the real-life problem and convert it to Relational Database.
Conclusion:
Thus, I have successfully drawn the ER Diagram for HOTEL MANAGEMENT SYSTEM
and converted into Relational Schema using ERD PLUS .
Marks
Obtained