chapter 2 data entity relationship
Post on 03-Apr-2018
220 Views
Preview:
TRANSCRIPT
-
7/28/2019 Chapter 2 Data Entity Relationship
1/31
-
7/28/2019 Chapter 2 Data Entity Relationship
2/31
DEFINE THE ENTITY
IDENTIFY THE ENTITY TYPES AND SETS OF ENTITY
EXPLAIN THE ATTRIBUTE AND A VALUE SET
EXPLAIN E-R MODEL
EXPLAIN THE FOLLOWING RELATIONSHIPTYPES IN E-R MODEL:
1:1(ONE TO ONE)
1:M(ONE TO MANY)
M:N(MANY TO MANY)
DRAW E-R MODEL BASED ON A GIVEN SITUATION
-
7/28/2019 Chapter 2 Data Entity Relationship
3/31
Entity is an object of the real world which can
store data and can be defined with clarity.
Example : something that exist physically such
as individual, place, article or something thatexists conceptually such as an event or concept
in a user environment.
-
7/28/2019 Chapter 2 Data Entity Relationship
4/31
ENTITY EXAMPLE
invidual Customer, Worker, Supplier
venue / place District, State, Country
object Stationary, Furniture
event Purchase Order, Booking, Sale
concept Project, Account, Unit
-
7/28/2019 Chapter 2 Data Entity Relationship
5/31
Recursive Entity
-A recursive entity is one in which a relation canexist between occurrences of the same entityset. This occurs in a unary relationship.
Composite Entity-If a Many to Many relationship exist we mustcreate a bridge entity to convert it into 1 to
Many. Bridge entity composed of the primarykeys of each of the entities to be connected. Thebridge entity is known as a composite entity. Acomposite entity is represented by a diamondshape with in a rectangle in an ER Diagram.
-
7/28/2019 Chapter 2 Data Entity Relationship
6/31
Strong Entity Type
Entity type that is not existence-dependent on
some other entity type.
Weak Entity Type Entity type that is existence-dependent on some
other entity type.
-
7/28/2019 Chapter 2 Data Entity Relationship
7/31
-
7/28/2019 Chapter 2 Data Entity Relationship
8/31
-
7/28/2019 Chapter 2 Data Entity Relationship
9/31
Entity Set
An entity may be concrete such as a person,book etc or may be abstract such asaccount,loan etc. The ER model refers to a
specific table row as an entity instance or entityoccurrence. Collection of similar entities (EntitySet) often corresponds to a table. Each entity sethas a key.All entities in an entity set have thesame set of attributes. Thus entity set is a set of
entities of the same type that share the sameproperties or attributes. An entity is representedby a rectangle containing the entity name, whichis a noun usually written in capital letters.
-
7/28/2019 Chapter 2 Data Entity Relationship
10/31
A description or an entity characteristic isknown as an attribute.
Used to differentiate object in an entity.
The symbol used to represent attribute isoval and connected to entities by lines
-
7/28/2019 Chapter 2 Data Entity Relationship
11/31
-
7/28/2019 Chapter 2 Data Entity Relationship
12/31
Simple Attribute has only one component,exist independently and cannot be brokenup. ( name or gender )
Composite Attribute comprises of manycomponents, each one existingindependently. (address with sub attributes such as house_no, road_no,
town, postcode)
-
7/28/2019 Chapter 2 Data Entity Relationship
13/31
Solitary Valued Attribute is an attribute thatconsists of only a single value. (matric_no, ic_no )
Multi-Valued Attribute is an attribute
consisting of many values. ( telephone no)Derived Attribute is an attribute where its
values is derived from the value of relatedattributes or set of other attributes.( ageattribute derived from the date of birth )
-
7/28/2019 Chapter 2 Data Entity Relationship
14/31
[ composite attribute ]
[ multi-valued attribute]
[ derived attribute]
[ simple attribute]
STUDENT
matricno
age
address
dateofbirth
gender
studentname
postcode
garden
road
houseno
phoneno
specialty
-
7/28/2019 Chapter 2 Data Entity Relationship
15/31
TYPES IN
ER MODEL
ONE TO
ONEONE TO
MANYMANY TO
MANY
-
7/28/2019 Chapter 2 Data Entity Relationship
16/31
-
7/28/2019 Chapter 2 Data Entity Relationship
17/31
One to one 1 :1 This type of relationship takes place when a
single occurrence of an entity is related to just
one
Occurrence of a second entity. For example, a ROOF covers one BUILDING; a
BUILDING is covered by one ROOF.
-
7/28/2019 Chapter 2 Data Entity Relationship
18/31
-
7/28/2019 Chapter 2 Data Entity Relationship
19/31
-
7/28/2019 Chapter 2 Data Entity Relationship
20/31
One-to-many 1:M
Relationships occur when each record in TableA
may have many linked records in TableB but
each record in TableB may have only onecorresponding record in TableA.
-
7/28/2019 Chapter 2 Data Entity Relationship
21/31
-
7/28/2019 Chapter 2 Data Entity Relationship
22/31
EXAMPLE II
In the one-to-many relationship a loan is
associated with at most one customer viaborrower, a customer is associated with
several (including 0) loans via borrower
-
7/28/2019 Chapter 2 Data Entity Relationship
23/31
-
7/28/2019 Chapter 2 Data Entity Relationship
24/31
Many to manyM: N
Relationship where multiple rows from table A can
correspond to multiple rows in table B.
An example of such a relationship is a schoolwhere teachers teach students.
In most schools each teacher can teach multiple
students and each student can be taught by
multiple teachers.
-
7/28/2019 Chapter 2 Data Entity Relationship
25/31
-
7/28/2019 Chapter 2 Data Entity Relationship
26/31
EXAMPLE II
A customer is associated with several (possibly 0)
loans via borrower A loan is associated with several (possibly 0)
customers via borrower
-
7/28/2019 Chapter 2 Data Entity Relationship
27/31
-
7/28/2019 Chapter 2 Data Entity Relationship
28/31
-
7/28/2019 Chapter 2 Data Entity Relationship
29/31
The relationship type orderconnects
entities chemical and supplier. The relationship is many-to-many because
each chemical can be from several suppliers
and each supplier has a number of
chemicals.
-
7/28/2019 Chapter 2 Data Entity Relationship
30/31
An order has a purchase date, amount, and
total cost as well as the chemical and
supplier information.
Thus, orderhas attributes PurchaseDate,
amount, and TotalCost that we cannot
appropriately associate
with chemical or supplier.
-
7/28/2019 Chapter 2 Data Entity Relationship
31/31
top related