0% found this document useful (0 votes)
18 views12 pages

Chapter 2 Data Merise

Uploaded by

ndjobaprincesse8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views12 pages

Chapter 2 Data Merise

Uploaded by

ndjobaprincesse8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

CHAPTER2 : DATA MODELS

I- The Data base Design Process

The database design process involves three major stages:


1. Conceptual Design During the conceptual design stage the database designer builds an
entity-relationship model (ERM) of the data. The purpose of the conceptual design stage is to
describe the structure of the data independently of a particular database management system.
2. Logical Design During the logical design stage the database designer translates the
conceptual design (ERM) into a logical data model. The relational data model (RDM) is a
logical data model. When an RDM is used, the ERM is translated into a set of relations.
3. Physical Design During the physical design stage the database designer implements the
logical data model in a specific database management system (DBMS). When the logical data
model is a relational model, the designer must create a set of relations in the DBMS.
Entity Relationship Diagram – ER Diagram in DBMS
An Entity–relationship model (ER model) describes the structure of a database with the help
of a diagram, which is known as Entity Relationship Diagram (ER Diagram). An ER model
is a design or blueprint of a database that can later be implemented as a database. The main
components of E-R model are: entity set and relationship set.
What is an Entity Relationship Diagram (ER Diagram)?
An ER diagram shows the relationship among entity sets. An entity set is a group of similar
entities and these entities can have attributes. In terms of DBMS, an entity is a table or attribute
of a table in database, so by showing relationship among tables and their attributes, ER diagram
shows the complete logical structure of a database. Lets have a look at a simple ER diagram to
understand this concept.
Facts about ER Diagram Model:
ER model allows you to draw Database Design
It is an easy to use graphical tool for modeling data
Widely used in Database Design
It is a GUI representation of the logical structure of a Database
It helps you to identifies the entities which exist in a system and the relationships between those
entities
Why use ER Diagrams?
Here, are prime reasons for using the ER Diagram
Helps you to define terms related to entity relationship modeling
Provide a preview of how all your tables should connect, what fields are going to be on each
table
Helps to describe entities, attributes, relationships
ER diagrams are translatable into relational tables which allows you to build databases quickly
ER diagrams can be used by database designers as a blueprint for implementing data in specific
software applications

II- RELATIONSHIP

Depending on the cardinality of the relationship and


subsequently the participation, we consider how to
represent the following relationships:
• Binary relationships:
• one-to-many (1:*);
• many-to-many (*:*)
• one-to-one (1:1);
one-to-many (1:*)
The entity on the ‘one side’ of the relationship is designated as
the parent entity and the entity on the ‘many side’ is
designated as the child entity.
• To represent this relationship, post a copy of the primary
key attribute(s) of the parent entity (one side) into the
relation representing the child entity (many side), to act
as a foreign key.
• If the relationship has one or more attributes, these attributes
should follow the posting of the primary key to the child
relation.

one-to-many (1:*)
II- ER diagram symbols and notation

ELEMENTS IN ER DIAGRAMS
There are three basic elements in an ER Diagram: entity, attribute, relationship. There are
more elements which are
based on the main elements. They are weak entity, multivalued attribute, derived attribute,
weak relationship and
recursive relationship. Cardinality and ordinality are two other notations used in ER diagrams
to further
define relationships.
Entity
An entity can be a person, place, event, or object that is relevant to a given system. For
example, a school system
may include students, teachers, major courses, subjects, fees, and other items. Entities are
represented in ER
diagrams by a rectangle and named using singular nouns.
Weak Entity
A weak entity is an entity that depends on the existence of another entity. In more technical
terms it can defined as
an entity that cannot be identified by its own attributes. It uses a foreign key combined with
its attributed to form the
primary key. An entity like order item is a good example for this. The order item will be
meaningless without an
order so it depends on the existence of order.

Weak Entity Example in ER diagrams


Attribute
An attribute is a property, trait, or characteristic of an entity, relationship, or another attribute.
For example, the
attribute Inventory Item Name is an attribute of the entity Inventory Item. An entity can have
as many attributes as
necessary. Meanwhile, attributes can also have their own specific attributes. For example, the
attribute “customer
address” can have the attributes number, street, city, and state. These are called composite
attributes. Note that
some top level ER diagrams do not show attributes for the sake of simplicity. In those that do,
however, attributes
are represented by oval shapes.

Attributes in ER diagram, note that an attribute can have its own attributes ( composite
attribute )
Multivalued Attribute
If an attribute can have more than one value it is called an multivalued attribute. It is
important to note that this is
different to an attribute having its own attributes. For example a teacher entity can have
multiple subject values.

Example of a multivalued attribute


Derived Attribute
An attribute based on another attribute. This is found rarely in ER diagrams. For example for
a circle the area can
be derived from the radius.

Derived Attribute in ER diagram


RELATIONSHIP
A RELATIONSHIP DESCRIBES HOW ENTITIES INTERACT. FOR EXAMPLE, THE ENTITY “CARPENTER” MAY BE RELATED TO THE
ENTITY “TABLE”
BY THE RELATIONSHIP “BUILDS” OR “MAKES”. RELATIONSHIPS ARE REPRESENTED BY DIAMOND
SHAPES AND ARE LABELED USING
VERBS.

Using Relationships in Entity Relationship Diagrams


Recursive Relationship
If the same entity participates more than once in a Relationship it is known as a recursive
relationship. In the below
example an employee can be a supervisor and be supervised, so there is a recursive
relationship.

III- Total/Partial Participation


Let R be a relationship set between entity sets A and B. The
participation of A is total if every entity of A must participate in at least
one relationship in R. Otherwise, the participation of A is partial.
Likewise, we can define total or participation of B.
Example: In the following relationship, the participation of A is total,
while that of B is partial

REPRESENTATION A RELATIONSHIP SET IN ER DIAGRAMS


Basic representation of a binary relationship set R between entity sets A
and B.

The line connecting A and R may:


Carry an arrow: Meaning one (as in one-to-many).
Not carry an arrow: Meaning many.
Be a double line: Meaning total participation.
Be a single line: Meaning partial participation.
Examples:
Alternative Notations

IV- TRANSLATION INTO THE RELATIONAL MODEL


• The second step of logical design corresponds to a translation
between different data models.
• Starting from an E-R schema, an equivalent relational schema is
constructed. By equivalent, we mean a schema capable of
representing the same information.
• We will deal with the translation problem systematically, beginning
with the Fundamental case, that of entities linked by many-to-many
relationship
Exemple 1
Exemple 1
Example3

Example4

You might also like