: Mrs. GOONJAN JAIN
SUBMITTED BY : PANKAJ JAISWAL
THE ENTITY –RELATIONSHIP MODEL
An entity relationship model, also called an entity-relationship (ER) diagram, is a graphical representation
of entities and their relationships to each other
The E-R modeling process identifies three basic elements: entities,
attributes and relationships.
Guidelines for constructing E-R
Identify entities: The first step in
creating an E-R diagram is to model the entities.
An entity is a person, place, object, event or concept, and usually can
be identified by a single, unique attribute.
It is helpful to look for possible primary keys for an entity.
Generally, when a form has an identifier for a possible entity, it is likely to
be the entity. For example, if a form contains a space for a customer name or
customer number, then the E-R diagram probably needs to have a CUSTOMER entity.
2. Identify attributes: Identify the attributes for each entity
If the price of a product does not change from one
order to another, then PRICE is a function of PRODUCT. If, however, different
orders for the same product have different prices, then PRICE is a function of
the relationship between PRODUCT and ORDER.
ORDER_NO, DATE, AMOUNT
However, all cases
are not so clear. Take the example of ADDRESS. Perhaps a number of attributes
were identified for this candidate entity, such as NUMBER, STREET, STATE, ZIP_CODE.
Does the presence of these potential attributes of ADDRESS indicate that ADDRESS
is an entity? Although, all of these should be attributes of some other entity,
such as CUSTOMER.
Choose Primary Keys:
After identifying and modeling each entity and its attributes, primary
keys must be chosen for each entity.
identifies an entity instance.
(always has a value)
4. Never changes
Characteristics of a Good Primary Key
4. Identify the Relationships:
entities are a critical part of the Entity Relationship Diagram. When these
relationships are implemented in the database, they provide the links among the
various tables that give the database its flexibility. To maximize the flexibility
of a database, relationships must be properly identified and modeled.
Many relationships are relatively easy to
recognize, such as those between ORDERS and CUSTOMERS, ORDER and CUSTOMER are related, as
are ORDER and PRODUCT. However, we know that there may not necessarily be a
relationship between PRODUCT and CUSTOMER. Because both are related to ORDER we
can report which products are ordered by a particular customer.
5. Determine Cardinalities:
There are both
maximum and minimum cardinalities.
ONE TO ONE
ONE TO MANY
MANY TO MANY
EXACTLY ONEONR OR MORE
ZERO OR ONEZERO OR MORE
There are two
relationships, one between PRODUCT and ORDER, and the other between ORDER and
Each customer can place: min =0, max = many orders
Each order can be placed by: min one max one customers
Each order can list: min one max many products
Each product can be listed on: min zero max many orders
The final step in
creating an E-R diagram is often overlooked, but is just as important as any of
the previous steps. Analysts who fail to carefully check their ERD often
produce diagrams of poor quality, which of course should be avoided.
In order to check
the ERD, you must return to your original information sources, the forms,
reports, and interviews with users. The basic idea is to go back to the
original documents and make sure that the structure represented in the ERD can
satisfy the requirements.