0% found this document useful (0 votes)
7 views16 pages

Mapping ERD To RDBMS

The document outlines the mapping of conceptual data models to relational database management systems (RDMS) through examples of one-to-one, one-to-many, and many-to-many relationships. It details the steps to create an Entity-Relationship Diagram (ERD), including entity and relationship identification, cardinality, and attribute mapping, along with best practices for effective ER diagrams. Additionally, it discusses generalization, specialization, and aggregation in database management systems, illustrating how entities can be combined or divided based on common attributes.

Uploaded by

hammadnaeem437
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views16 pages

Mapping ERD To RDBMS

The document outlines the mapping of conceptual data models to relational database management systems (RDMS) through examples of one-to-one, one-to-many, and many-to-many relationships. It details the steps to create an Entity-Relationship Diagram (ERD), including entity and relationship identification, cardinality, and attribute mapping, along with best practices for effective ER diagrams. Additionally, it discusses generalization, specialization, and aggregation in database management systems, illustrating how entities can be combined or divided based on common attributes.

Uploaded by

hammadnaeem437
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Database System

Week-8
Muhammad Ans Khalid
Mapping Conceptual to RDMS
One to One
DeptId DeptName DeptId(FK) ChId(FK) ChId ChName

101 CS 101 1001 1001 Ahmad

102 Law 102 1002 1002 Ali

103 Finance 103 1003 1003 Bilal


DeptId DeptName ChId(FK) ChId ChName

101 CS 1001 1001 Ahmad

102 Law 1002 1002 Ali

103 Finance 1003 1003 Bilal


One to Many
CustId CustName CustId(FK) OrderId(FK) OrderId ItemName Cost

101 Ahmad 101 1001 1001 Mobile 50000

102 Ali 101 1002 1002 Cloth 3000

103 Bilal 102 1003 1003 Shoes 2000


CustId CustName OrderId ItemName Cost CustId(F.K)

101 Ahmad 1001 Mobile 50000 101

102 Ali 1002 Cloth 3000 101

103 Bilal 1003 Shoes 2000 102


Many to Many
StutId StuName Age StutId CourseID CourseID CourseName

101 Ahmad 20 101 1002 1001 AICT

102 Ali 23 101 1002 1002 PF

103 Akram 19 102 1002 1003 OOP

102
1003
103 1003
Steps to Create an ERD (E-R Digram)
Following are the steps to create an ERD.

Let's study them with an example:


In a university, a Student enrolls in Courses. A student must be assigned to at least one or more
Courses. Each course is taught by a single Professor. To maintain instruction quality, a
Professor can deliver only one course
Step 1) Entity Identification
We have three entities
 Student
 Course
 Professor

Step 2) Relationship Identification


We have the following two relationships
 The student is assigned a course
 Professor delivers a course

Step 3) Cardinality Identification


For them problem statement we know that,
 A student can be assigned multiple courses
 A Professor can deliver only one course

Step 4) Identify Attributes


You need to study the files, forms, reports, data currently maintained by the organization to
identify attributes. You can also conduct interviews with various stakeholders to identify
entities. Initially, it's important to identify the attributes without mapping them to a particular
entity.
Once, you have a list of Attributes, you need to map them to the identified entities. Ensure an
attribute is to be paired with exactly one entity. If you think an attribute should belong to more
than one entity, use a modifier to make it unique.
Once the mapping is done, identify the primary Keys. If a unique key is not readily available,
create one.

Entity Primary Key Attribute

Student Student_ID StudentName

Professor Employee_ID ProfessorName

Course Course_ID CourseName


For Course Entity, attributes could be Duration, Credits, Assignments, etc. For the sake of ease
we have considered just one attribute.
Step 5) Create the ERD
A more modern representation of ERD Diagram

Best Practices for Developing Effective ER Diagrams


 Eliminate any redundant entities or relationships
 You need to make sure that all your entities and relationships are properly labeled
 There may be various valid approaches to an ER diagram. You need to make sure that
the ER diagram supports all the data you need to store
 You should assure that each entity only appears a single time in the ER diagram
 Name every relationship, entity, and attribute are represented on your diagram
 Never connect relationships to each other
 You should use colors to highlight important portions of the ER diagram
Summary
 The ER model is a high-level data model diagram
 ER diagrams are a visual tool which is helpful to represent the ER model
 Entity relationship diagram displays the relationships of entity set stored in a database
 ER diagrams help you to define terms related to entity relationship modeling
 ER model is based on three basic concepts: Entities, Attributes & Relationships
 An entity can be place, person, object, event or a concept, which stores data in the
database
 Relationship is nothing but an association among two or more entities
 A weak entity is a type of entity which doesn't have its key attribute
 It is a single-valued property of either an entity-type or a relationship-type
 It helps you to defines the numerical attributes of the relationship between two entities
or entity sets
 ER- Diagram is a visual representation of data that describe how data is related to each
other
 While Drawing ER diagram you need to make sure all your entities and relationships
are properly labeled.

DBMS Generalization
Generalization is a process in which the common attributes of more than one entities form a
new entity. This newly formed entity is called generalized entity.
Generalization Example
Lets say we have two entities Student and Teacher.
Attributes of Entity Student are: Name, Address & Grade
Attributes of Entity Teacher are: Name, Address & Salary

The ER diagram before generalization looks like this:

These two entities have two common attributes: Name and Address, we can make a generalized
entity with these common attributes. Lets have a look at the ER model after generalization.
The ER diagram after generalization:
We have created a new generalized entity Person and this entity has the common attributes of
both the entities. As you can see in the following ER diagram that after the generalization
process the entities Student and Teacher only has the specialized attributes Grade and Salary
respectively and their common attributes (Name & Address) are now associated with a new
entity Person which is in the relationship with both the entities (Student & Teacher).

Note:
1. Generalization uses bottom-up approach where two or more lower level entities combine
together to form a higher level new entity.
2. The new generalized entity can further combine together with lower level entity to create a
further higher level generalized entity.

DBMS Specialization
Specialization is a process in which an entity is divided into sub-entities. You can think of it
as a reverse process of generalization, in generalization two entities combine together to form
a new higher level entity. Specialization is a top-down process.
The idea behind Specialization is to find the subsets of entities that have few distinguish
attributes. For example – Consider an entity employee which can be further classified as sub-
entities Technician, Engineer & Accountant because these sub entities have some distinguish
attributes.
Specialization Example
In this diagram, we can see that we have a higher level entity “Employee” which we have
divided in sub entities “Technician”, “Engineer” & “Accountant”. All of these are just an
employee of a company, however their role is completely different and they have few different
attributes. Just for the example, I have shown that Technician handles service requests,
Engineer works on a project and Accountant handles the credit & debit details. All of these
three employee types have few attributes common such as name & salary which we had left
associated with the parent entity “Employee” as shown in the above diagram.
DBMS Aggregration
Aggregation is a process in which a single entity alone is not able to make sense in a
relationship so the relationship of two entities acts as one entity. I know it sounds confusing
but don’t worry the example we will take, will clear all the doubts.
Aggregration Example

In real world, we know that a manager not only manages the employee working under them
but he has to manage the project as well. In such scenario if entity “Manager” makes a
“manages” relationship with either “Employee” or “Project” entity alone then it will not make
any sense because he has to manage both. In these cases the relationship of two entities acts as
one entity. In our example, the relationship “Works-On” between “Employee” & “Project” acts
as one entity that has a relationship “Manages” with the entity “Manager”.

You might also like