0% found this document useful (0 votes)
28 views

Databa

The document discusses transforming entity-relationship diagrams into relational database schemas by mapping different types of entities, relationships, and attributes into tables and relations. It covers mapping regular entities, weak entities, binary relationships, associative entities, unary relationships, and ternary relationships.

Uploaded by

lewissikanyika35
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)
28 views

Databa

The document discusses transforming entity-relationship diagrams into relational database schemas by mapping different types of entities, relationships, and attributes into tables and relations. It covers mapping regular entities, weak entities, binary relationships, associative entities, unary relationships, and ternary relationships.

Uploaded by

lewissikanyika35
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/ 6

7/11/2014

Objectives of logical design...


• Translate the conceptual design into a
logical database design that can be
implemented on a chosen DBMS
Logical database design – Input: conceptual model (ERD)
– Output: relational schema, normalized
and the relational model relations

Transforming the ERD


Relational database components diagram into relations
• Data structure
The steps:
– Data organized into tables
• Map regular entities
• Data manipulation
• Map weak entities
– Add, delete, modify, and retrieve using
SQL
• Map binary relationships
• Map associative entities
• Data integrity
• Map unary relationships
– Maintained using business rules
• Map ternary relationships

Transforming E-R Mapping a composite attribute


diagrams into relations
Mapping regular entities to relations.
• Identify the primary key
– Composite attributes: use only
their simple, component attributes
– Multi-valued attributes: become a
separate relation with a foreign
key taken from the superior entity

1
7/11/2014

Looks like this using relational Transforming E-R


schema notation diagrams into relations
Mapping weak entities
– Becomes a separate relation with a
foreign key taken from the
superior entity.
– The primary key is a combination of
the parent identifier and the weak
entity identifier.

Example of mapping a weak Looks like this using


entity relational schema notation

Transforming E-R Transforming E-R


diagrams into relations diagrams into relations
Mapping binary relationships – Many-to-many - create a new
– One-to-many - primary key on the relation (associative entity) with the
one side becomes a foreign key on primary keys of the two entities as
the many side its primary key
– One-to-one - primary key on the
mandatory side becomes a foreign
key on the optional side

2
7/11/2014

Example of mapping a 1:M Looks like this using


relationship relational schema notation

Example of mapping an Looks like this using


M:M relationship relational schema notation

Mapping a binary 1:1 Looks like this using


relationship relational schema notation

3
7/11/2014

Transforming E-R Transforming E-R


diagrams into relations diagrams into relations
Mapping associative entities – Identifier assigned
– Identifier not assigned • It is natural and familiar to end-
• Default primary key for the users
association relation is the • Default identifier may not be
primary keys of the two entities unique

Mapping an associative Looks like this using


entity with an identifier relational schema notation

Transforming E-R Example


diagrams into relations
Mapping unary relationships
• One-to-many - A foreign key attribute is EmpNo

added within the same relation that Supervises


references the primary key values (this EmpName Employee
foreign key must have the same domain as
the primary key)
EmpAdress
• A recursive foreign key is a foreign key in
a relation that references the primary key
values of that same relation

4
7/11/2014

Unary Many-to-many
Would look like... • Here two relations are created, one to
represent the entity type in the
relationship and another representing the
M:N relationship itself
• The primary key of the associative
relation consists of two attributes, both
taking their values from the primary key
of the other relation
• Any non-key attribute of the relationship
is included in the associative relation

Example
Would look like...
(b) ITEM and
COMPONENT
relations

(a) Bill-of-materials
relationships (M:N)

Mapping ternary (and n-ary)


Mapping ternary (and n-
relationships
• convert a ternary relationship to an ary) relationships
associative entity in order to represent • These attributes then act in the role
participation constraints more of foreign keys that reference the
accurately. individual primary keys of the
• Firstly, we create a new associative participating entity types .
relation. • Any attributes of the associative
• The default primary key of this relation entity type become attributes of the
consists of the three primary key new relation
attributes for the participating entities

5
7/11/2014

Mapping a ternary relationship Looks like this using relational


schema notation

Questions

You might also like