database management system by - wordpress.com · database management system by meri dedania...
TRANSCRIPT
Prepared By Meri Dedania (AITS)
Database Management System
byMeri DedaniaAssistant Professor
MCA department
Atmiya Institute of Technology & Science
Yogidham Gurukul
Rajkot
Prepared By Meri Dedania (AITS)
Chapter -6
Entity Relationship Data Model
Prepared By Meri Dedania (AITS)
6.2 – The Entity-Relationship ModelWhy E-R data model is introduced?
Database Design of larger Relational Database
Easy to Understand
The basic Notions of E – R data model
1) Entity Set :
Table
2) Relationship Set:
3) Attributes:
Column
Prepared By Meri Dedania (AITS)
Entity SetWhat is Entity?
An entity is a thing or object in the real world that is
distinguishable from all other objects.
An entity has some set of properties and value for
some set of properties may uniquely identifies.
What is entity set?
An entity set is set of entities of the same type that
share the same properties or attributes.
The individual entities that represents a set are said to
be the extension of entity set.
Prepared By Meri Dedania (AITS)
Types of Entity(Concrete & Abstract)
Entity may be concrete(Tangible) like a person or a
book or customer or employee.
Or it may be abstract(intangible) like a holiday ,
transaction or loan.
What are Attributes?
An entity is represented by a set of attributes.
Attributes are descriptive properties hold by
each member of entity set.
Values of entity for each of its attributes.
Prepared By Meri Dedania (AITS)
Prepared By Meri Dedania (AITS)
Examples for each term
A person who are customer of particular bank is entity
of entity set CUSTOMER.
So CUSTOMER is entity set and all persons who are
customers of bank are entities.
Some Properties or Attributes Which are shared by
CUSTOMER are cust_id , cust_name , c_street , c_city.
CUSTOMER is Tangible Entity.
One another example is LOAN entity set contains
information for the loan given by particular bank to
Customer.
LOAN has Attributes like loan_num , amount.
Loan is intangible entity.
Prepared By Meri Dedania (AITS)
The value of Properties like 1001 for cust_id , Hayes
for cust_name , Main for c_street , Harrison for c_city
Entity set do not need to be disjoint.
Suppose one Entity set EMPLOYEE for information of
employee are in particular bank.
Who is also Customer of bank.
That person will entity of CUSTOMER & EMPLOYEE
both , or none.
The cust_id & loan_num attributes are used to
identify customer and loan uniquely respectively.
Prepared By Meri Dedania (AITS)
AttributesWhat is Attributes?
Attributes are descriptive properties which hold by
each member of entity set.
Domain or value set
The set of permitted value called Domain or value
set of that attribute.
Example of Domain
Like Domain of cust_name is set of string of a certain
length.
Similarly , loan_num is set of string of the form “L-n”
where n is positive integer.
Prepared By Meri Dedania (AITS)
An attribute of an entity set is a function that maps
from the entity set into a domain.
Since an entity set have several attributes , each entity
can be described by a set of pairs , one pair for each
attributes of the entity set.
A particular CUSTOMER entity may be describe by the
set (cust_id , 1001) , (cust_name , Hayes),(c_street , Main
) , (c_city , Harrison).
Prepared By Meri Dedania (AITS)
Types of Attributes :
1) Simple and composite attributes
Which attribute does not divide into subpart is called simple attributes.
For example Cust_name in CUSTOMER does not have subpart.
Which Attributes divided into subparts is called Composite Attributes.
Cust_name divided into First_name , Middle_name , Last_name.
Also we can substitute the composite attribute like address for C_street , C_city.
Note that composite attribute may appear as a hierarchy.
In Composite attribute like Address is divided into street_number , street_name , and appartment_number.
Prepared By Meri Dedania (AITS)
Prepared By Meri Dedania (AITS)
2) Single – valued and multivalued Attributes.
Which attributes have single value for particular entity is called single valued attribute.
Which attributes have multiple value for particular entity is called multi valued attribute.
For example in LOAN , the loan_num attribute for a specific loan entity refers to only one loan number.
Assume that an entity set EMPLOYEE has attribute like phone_number.
An employee may have zero , one or more phone number.
Another example of dependant_name of an EMPLOYEE would have zero , one or more dependant.
The upper bound and lower bound of multi value can be assign in number.
Prepared By Meri Dedania (AITS)
3) Derived Attribute
The value of this kind of attribute can be derived
from the values of other related attributes or
entities.
For example , the customer entity set has attribute age
that indicates the customer’s age.
If CUSTOMER has also attribute like Date_of_birth.
We can calculate age from the date_of_birth and the
current date.
So age is derived attribute and date_of_birth is called
based or stored attribute.
The value of a derived attribute not stored but is
computed when required.
Prepared By Meri Dedania (AITS)
Relationship SetWhat is relationship?
A relationship is an association among several entities.
For example , two entity sets CUSTOMER and LOAN.
The relationship set borrower to denote the association between CUSTOMER and bank loans that the customers have.
The association between entity sets is referred to as participation.
The function that an entity plays in a relationship is called that entity’s role.
The same entity set participates in a relationship set more then once , in different roles is called recursiverelationship set.
Prepared By Meri Dedania (AITS)
Prepared By Meri Dedania (AITS)
A relationship may also have attributes called
descriptive attributes.
Prepared By Meri Dedania (AITS)
The relationship set borrower provide an example of
a binary relationship set.
Binary relationship set involves two entity sets.
The number of entity sets that participate in a
relationship set is also the degree of the relationship
set.
For example , a binary relationship set is of degree 2.
Prepared By Meri Dedania (AITS)
6.3 - Constraints E – R enterprise schema may define certain constraints
which data value must satisfy.
Here we examine mapping cardinalities , key constraints
and participation constraints.
1) 6.3.1- Mapping Cardinalities :
It represents number of entities to which another
entity can be associated via a relationship set.
It is very useful to describe binary relationship
sets.
The mapping cardinality must be one of the
following.
Prepared By Meri Dedania (AITS)
One to One :
Any entity set A is associated with at most one entity
in B.
And an entity in B is associated at most one entity in A.
Prepared By Meri Dedania (AITS)
One to Many :
An entity in A is associated with any(zero or more)
number of entities in B.
An entity in B , however , can be associated with at
most one entity in A.
Prepared By Meri Dedania (AITS)
Many to One :
An entity in A is associated with at most one entity in
B.
An entity in B , however , can be associated with any
number(zero or more)of entity in A.
Prepared By Meri Dedania (AITS)
Many to many :
An entity in A is associated with any number (zero or
more) of entities in B.
And an entity in B is associated with any number (zero
or more) of entities in A.
Prepared By Meri Dedania (AITS)
2) 6.3.2- Keys
Entity Sets
Relationship Sets
Prepared By Meri Dedania (AITS)
3) 6.3.3 - Participation Constraints
If every entity in entity set E participates in at least
one relationship in R. then relationship set R is said
to be total.
If some entity in entity set E participates in
relationship set R then R is said to be Partial.
Prepared By Meri Dedania (AITS)
6.4 – Entity Relationship Diagrams E – R diagram can express the overall logical
structure of a database graphically.
Diagram consists of the following major components.
Prepared By Meri Dedania (AITS)