You are on page 1of 9

SIDDHANT BHALLA

19070124062
IT 3

DBMS LAB ASSIGNMENT 2

Q1) Explain the need of EER diagrams.

Ans: The reasons are as follows:


(a)  Represents requirements and complexities of complex
databases. 
(b) It is a diagrammatic technique for displaying the Sub
Class and Super Class; Specialization and Generalization;
Union or Category; Aggregation etc
(c) It defines a explained relationship between entities and its
sub entities.
(d) EER is a high-level data model that incorporates the
extensions to the original ER model. Enhanced ERD are
high level models that represent the requirements and
complexities of complex database.
(e) Represents relationship between a whole object and its
component.
Q2) Explain in detail Generalization, specialization and
Aggregation and how do we convert them into relational
model.
Ans: Generalization: It is a process of generalizing an entity which
contains generalized attributes or properties of generalized entities.

It is a Bottom up process i.e. consider we have 3 sub entities Car,


Truck and Motorcycle. Now these three entities can be generalized
into one super class named as Vehicle.
Specialization:It is a process of identifying subsets of an entity that
share some different characteristic. It is a top down approach in which
one entity is broken down into low level entity.

Owner is the subset of two super class: Vehicle and House.


Aggregation: Represents relationship between a whole object and its
component.

Consider a ternary relationship Works_On between Employee,


Branch and Manager. Now the best way to model this situation is to
use aggregation, So, the relationship-set, Works_On is a higher level
entity-set. Such an entity-set is treated in the same manner as any
other entity-set. We can create a binary relationship, Manager,
between Works_On and Manager to represent who manages what
tasks.

Steps to convert a EER into Relational Model:


(i) Initial steps are same as converting ER Diagram to Relational
model.
(ii) Mapping of Specialization or Generalization. Options for
Mapping Specialization or Generalization are below points:

(iii) Multiple relations—superclass and subclasses. Create a relation L


for C with attributes Attrs(L) = {k, a1, ..., an} and PK(L) = k.
Create a relation Li for each subclass Si , 1 ≤ i ≤ m, with the attributes
Attrs(L) = {k} ∪{attributes of Si} and PK(Li
) = k. This option works for any specialization(total or partial,
disjoint or overlapping)

(iv) Multiple relations—subclass relations only. Create a relation Li


for each subclass Si, 1 ≤ i ≤ m, with the attributes Attrs(Li) =
{attributes of Si} ∪ {k, a1, ..., an} and PK(Li) = k. This option only
works for a specialization whose subclasses are total (every entity in
the superclass must belong to (atleast) one of the subclasses).

(v) Single relation with one type attribute. Create a single relation
L with attributes Attrs(L) = {k, a1, ..., an} ∪ {attributes of S1} ∪ ... ∪
{attributes of Sm} ∪ {t} and PK(L) = k. The attribute t is called a
type (or discriminating) attribute whose value indicates the subclass to
which each tuple belongs, if any. This option works only for a
specialization whose subclasses are disjoint, and has the potential for
generating many NULL values if many specific attributes exist in the
subclasses.

(vi) Single relation with multiple type attributes. Create a single


relation schema L with attributes Attrs(L) = {k, a1, ..., an} ∪
{attributes of S1} ∪ ... ∪ {attributes of Sm} ∪{t1, t2, ..., tm} and
PK(L) = k. Each ti, 1 ≤ i ≤ m, is a Boolean type attribute indicating
whether a tuple belongs to subclass Si. This option is used for a
specialization whose subclasses are overlapping (but
will also work for a disjoint specialization).
Implementation Question:-

Q) Draw the EER for SIU Library Management and convert


into relational model.
Required Relational Model:
SIULIBRARY (Slid,lname,location,noofbranches)
Ilibrary(Lid, lname, city, area, slid)
BOOKS(Bid, Bname, Price , Lid)
AUTHOR(Aid, Aname,email,phone)
Written by(Bid, Aid, pid)
PUBLISHER(Pid, Pname)
SELLER(Sid, slname, city)
DEPARTMENT (Deptid, deptname, Iname,lid)
STUDENT(Stuid, Sname, email,memid deptid)
STAFF(Stid, stname, email, deptid,memid)
Sold by (sid, bid,pid)
Employee(eid,empname,email,salary,lid)
Member(memid, lid)

Q.2 Convert following EER to relational model


The required Relational Model is as follows:
PERSON( PersonID, Name, DOB, SSN, Department, Salary,
PersonType )
EMPLOYEE( EmpID, Department, Salary, Employee Type,
Specialization )
STUDENT( StuID, GPA, StartDate, Student Type )
SECRETARY( Secretary ID, Department, Salary )
TECHNECIAN( Technecian ID, Specialization, Department, Salary )
FRESHMAN( Freshman ID, GPA, Start Date )
SOPHMORE( Sophmore ID, Major, GPA, Start Date )
JUNIOR( JuniorID, Major, GPA, Start Date )
SENIOR( SeniorID, Major, Advisor, GPA, Start Date )

You might also like