Basic
concepts
1. Entity sets:
An entity is a “thing” or
“object” in the real world that is distinguishable from all other objects. For
example, each person in an enterprise is an entity. An entity has a set of
properties and the values for the some properties may uniquely identify an
entity. For example, the social-security number 677-89-9011 uniquely identities
one particular person in the enterprise. An entity set is a set of entities of
the same type that share properties, or attributes. The set of all persons who
are customers at a given bank, for example can be defined as the entity set
customer.
2. Simple and composite attribute:
The attribute that is not
divided in to subparts is called Simple attribute. For example, age attributes
of person entity.
The attribute divided into
subparts (i.e. other attributes for,
example customer-name could be structured as a composite attributes consisting
of first-name, middle-initial, and last-name.
3. Single-valued and multi valued attributes:
An attribute having a
single-value only is known as single values attribute. For example, date of
birth attribute of customer entity.
An attribute having a set of
values is known as multi values. For example, phone number attribute of
customer entity.
4. Derived attribute:
The values for this type of
attribute can be derived from the values of other related attributes or
entities. For example, the value of age attribute of customer entity can be
derived from date of birth attribute.
Entity- Relationship Diagram:
The entity relationship
(E-R) data model is based on a perception of a real world that consist of a
collection of basic objects, called entities, and of relationships among these
objects. Entities are described in a database by a set of attributes. A
relationship is an association among several entities. The relative simplicity
and pictorial clarity of this diagramming technique may well account in large
part for the widespread use of the E-R model. Such a diagram consists of the
followings major components:
Rectangles: which represent entity
sets
Ellipses: which represent attributes
Diamonds: which represent relationship
sets
Lines: which link attributes
to entity sets and entity to relationship sets
Double ellipses: which represent multi-valued attributes
Dashed ellipse: which denote derived attributes
Double lines: which indicated total participation
of an entity in a relationship sets
|
There Are Four Types Of Relationship:
- One to One
-
One to Many
-
Many to One
-
Many to Many
As depicted in Figure ,
attributes of an entity that are members of primary key are underlined.
Consider the entity-relationship
diagram in Figure , which consists of two entity sets of customers and loan,
related thought a binary relationship sets borrower. The attributes associated
with customer are customer-name, social-security, customer-street and
customer-city. The attributes associated with loan are loan-number and
amount.
The relationship set borrower may
be many-to-many, one-to-many, many-to-one, or one-to-one. To distinguish among
these types, we draw either a directed line (-->) or an undirected line (--)
between the relationship set and the entity set in question.
A directed line from the
relationship set borrower to the entity set loan specifies that either borrower
is a one-to-one, or many-to-one relationship set, from customer to loan;
borrower cannot be a many-to-many or a one-to-many relationship set, from
customer to loan.
An undirected line from the
relationship set borrower to the entity set loan specifies that either borrower
is a many-to-many, or one-to-many relationship set, from customer to loan.
Returning to the E-R diagram of
figure, we see that the relationship set borrower is many to many. If the
relationship set borrower were one to many, from customer to loan, then the
line from borrower to customer would be directed, with an arrow pointing to the
customer entity set (figure). Similarly, if the relationship set borrower
were many to one from customer to loan, then the line from borrower to loan
would have an arrow pointing to the loan entity set (Figure ). Finally, if
the relationship set borrower were one to one, then both lines form borrower
would have arrows: one pointing to the loan entity set, and one pointing to the
customer entity set (Figure ).
No comments:
Post a Comment