Professional Documents
Culture Documents
WriteUp 1
WriteUp 1
WriteUp 1
Problem Statement: Propose a Conceptual Design using ER features using tools like ERD plus
etc. (Identifying entities, relationships between entities, attributes, keys, cardinalities,
generalization, specialization etc.) Convert the ER diagram into relational tables ad normalize
Relational data model.
Objectives:
1. Learn the basics about ER diagram (entities, relationships between entities, attributes,
keys, cardinalities, generalization, and specialization). Decide a case study related to real
time application and design an ER diagram. Convert the ER diagram to relational tables.
2. Normalize Relational Data Model.
3. Mini-Project
Theory:
An ER diagram identifies the relationship among entity sets. An entity set is a group of
similar entities and these entities can have attributes. In terms of DBMS, an entity is a
table or attribute of a table in database, so by showing relationship among tables and their
attributes, ER diagram shows the complete logical structure of a database.
Example of ER diagram
Figure : ER diagram 1
Let’s discuss the above ER diagram in detail
Entity
Attribute
1. Key attribute
2. Composite attribute
3. Multi-valued attribute
4. Derived attribute
1. Key Attribute
A key attribute can uniquely identify an entity from an entity set. For example, student
Roll No can uniquely identify a student from a set of students. Key attribute is
represented by oval same as other attributes however the text of key attribute is
underlined.
2. Composite Attribute
4. Derived attribute:
A derived attribute is one whose value is dynamic and derived from another attribute. It is
represented by dashed oval in an ER Diagram. For example – Student age is a derived
attribute as it changes over time and can be derived from another attribute (Date of birth).
Cardinalities
When a single instance of an entity is associated with a single instance of another entity
then it is called one to one relationship. For example, one professor delivers only one
subject.
When a single instance of an entity is associated with more than one instances of another
entity then it is called one to many relationship. For example – a student can enroll to
many subjects
.
3. Many to One Relationship
When more than one instances of an entity is associated with a single instance of another
entity then it is called many to one relationship. For example – many students can study
in a single college.
When more than one instances of an entity is associated with more than one instances of
another entity then it is called many to many relationship. For example, Many students
can participate in many projects.
Generalization
Example: Suppose we have two entity types, Student and Faculty. The attributes of
Student entity type are Roll No, Name, Phone and Address. The attributes of Faculty
entity type are College_ID, Name, Phone, Address, Department, Email.
We can see that the three attributes i.e. Name, Phone, and Address are common here.
When we generalize these two entities, we form a new higher-level entity type Person.
Specialization
In the given ER diagram, ROLL No, COLLEGE ID are the key attribute
of the entity.
.
5. Composite attribute represented by components.
Normalization
Normalization is the process of organizing data in a database. This includes creating tables and
establishing relationships between those tables according to rules designed both to protect the
data and to make the database more flexible by eliminating redundancy and inconsistent
dependency.
TABLE 1
Tables should have only two dimensions. Since one student has several classes, these
classes should be listed in a separate table. Fields Class1, Class2, and Class3 in the above
records are indications of design trouble.
Spreadsheets often use the third dimension, but tables should not. Another way to look at
this problem is with a one-to-many relationship, do not put the one side and the many side
in the same table. Instead, create another table in first normal form by eliminating the
repeating group (Class#), as shown below:
TABLE 2
Note the multiple Class# values for each Student# value in the above table. Class# is not
functionally dependent on Student# (primary key), so this relationship is not in second
normal form.
The following tables demonstrate second normal form:
Students:
TABLE 3
Registration:
TABLE 4
Student Class
1022 101-07
1022 143-01
1022 159-02
4123 101-07
4123 143-01
4123 179-04
In the last example, Adv-Room (the advisor's office number) is functionally dependent on
the Advisor attribute. The solution is to move that attribute from the Students table to the
Faculty table, as shown below:
Students:
TABLE 5
Student Advisor
1022 Jones
4123 Smith
Faculty:
TABLE 6
Jones 412 42
Smith 216 42
Conclusion : Thus the concepts of ER-diagram and Normalization have been studied.