Methodology For DB Design Conceptual, Logical, Physical Database Design
Methodology For DB Design Conceptual, Logical, Physical Database Design
College of Engineering
Software & Informatics Engineering Department
2nd stage
Lecturer:
Hanan Kamal
2018-2019
Objectives
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
2
Database Design Methodology
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
3
Conceptual Database Design
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
4
Overview Database Design
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
Methodology
Conceptual database design
• Step 1 Build conceptual data model
1. Identify entity types
2. Identify relationship types
3. Identify and associate attributes with entity or
relationship types
4. Determine attribute domains
5. Determine candidate, primary, and alternate key
attributes
5
Overview Database Design
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
Methodology
Step 1 Build conceptual data model (continue)
6. Consider use of enhanced modeling concepts
(optional step)
7. Check model for redundancy
8. Validate conceptual model against user
transactions
9. Review conceptual data model with user
6
Step 1 Build Conceptual Data
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
8
Step 1 Build Conceptual Data
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
9
Step 1 Build Conceptual Data
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
12
Step 1 Build Conceptual Data Model
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
14
First-cut ER diagram for Staff user
views of DreamHome
15
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
Extract from data dictionary for Staff user views of
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
16
Extract from data dictionary for Staff user views of
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
17
DreamHome with primary keys added
ER diagram for Staff user views of
18
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
Revised ER diagram for Staff user views of
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
19
Example of removing a redundant
relationship called Rents
20
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
Using pathways to check that the conceptual
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
21
Step 2 Build and Validate Logical Data
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
Model
• To translate the conceptual data model into a
logical data model and then to validate this
model to check that it is structurally correct
using normalization and supports the
required transactions.
22
Step 2 Build and Validate Logical Data
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
Model
• Step 2.1 Derive relations for logical data
model
– To create relations for the logical data model to represent
the entities, relationships, and attributes that have been
identified.
23
Conceptual data model for Staff view
showing all attributes
24
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
Step 2.1 Derive relations for logical
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
data model
• Strong entity types
– For each strong entity in the data model, create a
relation that includes all the simple attributes of that
entity.
• Weak entity types
– For each weak entity in the data model, create a relation
that includes all the simple attributes of that entity. The
primary key of a weak entity is partially or fully derived
from each owner entity and so the identification of the
primary key of a weak entity cannot be made until after
all the relationships with the owner entities have been
mapped.
25
Step 2.1 Derive relations for logical
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
data model
• One-to-many (1:*) binary relationship types
– For each 1:* binary relationship, 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 parent entity into the relation
representing the child entity, to act as a foreign
key.
26
Step 2.1 Derive relations for logical
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
data model
• One-to-one (1:1) binary relationship types
– Creating relations to represent a 1:1 relationship is more complex as
the cardinality cannot be used to identify the parent and child entities
in a relationship. Instead, the participation constraints are used to
decide whether it is best to represent the relationship by combining
the entities involved into one relation or by creating two relations and
posting a copy of the primary key from one relation to the other.
– Consider the following
mandatory participation on both sides of 1:1
relationship;
mandatory participation on one side of 1:1
relationship;
optional participation on both sides of 1:1 relationship.
27
Step 2.1 Derive relations for logical
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
data model
• One-to-one (1:1) recursive relationships
– For a 1:1 recursive relationship, follow the rules for participation as
described above for a 1:1 relationship.
• mandatory participation on both sides, represent the
recursive relationship as a single relation with two copies of
the primary key.
• mandatory participation on only one side, option to create a
single relation with two copies of the primary key, or to
create a new relation to represent the relationship. The new
relation would only have two attributes, both copies of the
primary key. As before, the copies of the primary keys act as
foreign keys and have to be renamed to indicate the purpose
of each in the relation.
• optional participation on both sides, again create a new
relation as described above.
28
Step 2.1 Derive relations for logical
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
data model
• Superclass/subclass relationship types
– Identify superclass entity as parent entity and subclass entity as the
child entity. There are various options on how to represent such a
relationship as one or more relations.
– The selection of the most appropriate option is dependent on a
number of factors such as the disjointness and participation
constraints on the superclass/subclass relationship, whether the
subclasses are involved in distinct relationships, and the number of
participants in the superclass/subclass relationship.
29
30
superclass / subclass relationship
Guidelines for representation of
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
Representation of superclass / subclass relationship
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
31
Step 2.1 Derive relations for logical
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
data model
• Many-to-many (*:*) binary relationship types
– Create a relation to represent the relationship and include any
attributes that are part of the relationship. We post a copy of the
primary key attribute(s) of the entities that participate in the
relationship into the new relation, to act as foreign keys. These foreign
keys will also form the primary key of the new relation, possibly in
combination with some of the attributes of the relationship.
32
Step 2.1 Derive relations for logical
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
data model
• Complex relationship types
– Create a relation to represent the relationship and include
any attributes that are part of the relationship. Post a copy
of the primary key attribute(s) of the entities that
participate in the complex relationship into the new
relation, to act as foreign keys. Any foreign keys that
represent a ‘many’ relationship (for example, 1..*, 0..*)
generally will also form the primary key of this new
relation, possibly in combination with some of the
attributes of the relationship.
– For example, the ternary Registers relationship
33
Step 2.1 Derive relations for logical
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
data model
• Multi-valued attributes
– Create a new relation to represent multi-valued attribute
and include primary key of entity in new relation, to act as
a foreign key. Unless the multi-valued attribute is itself an
alternate key of the entity, the primary key of the new
relation is the combination of the multi-valued attribute
and the primary key of the entity.
34
Summary of how to map entities and
relationships to relations
35
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
Relations for the Staff user views of
DreamHome
36
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
Step 2.2 Validate relations using normalization
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
37
Step 2.4 Check integrity constraints
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
38
Referential integrity constraints for
relations in Staff user views of
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
DreamHome
39
Step 2.5 Review logical data model
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
with user
• To review the logical data model with the
users to ensure that they consider the model
to be a true representation of the data
requirements of the enterprise.
40
Step 2.6 Merge logical data models
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
41
Step 2.6.1 Merge local logical data
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
42
Logical v. Physical Database Design
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
43
Physical Database Design
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
44
Overview of Physical Database Design
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
Methodology
• Step 3 Translate logical data model for
target DBMS
– Step 3.1 Design base relations
– Step 3.2 Design representation of derived data
– Step 3.3 Design general constraints
45
Overview of Physical Database Design
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
Methodology
• Step 4 Design file organizations and
indexes
– Step 4.1 Analyze transactions
– Step 4.2 Choose file organizations
– Step 4.3 Choose indexes
– Step 4.4 Estimate disk space requirements
46
Overview of Physical Database Design
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
Methodology
• Step 5 Design user views
• Step 6 Design security mechanisms
• Step 7 Consider the introduction of
controlled redundancy
• Step 8 Monitor and tune operational
system
47
Assignment
PDF Created with deskPDF PDF Creator X - Trial :: http://www.docudesk.com
48