Design A Database
Design A Database
Database System
Database is collection of related data which
contained the fundamental element called table.
The table is related within each other that are
categorized into tuples and fields.
Database systems are designed to manage large
data set in an organization. The data management
involves both definition and the manipulation of the
data which ranges from simple representation of
the data to considerations of structures for the
storage of information. The data management also
consider the provision of mechanisms for the
manipulation of information.
Today, Databases are essential to every business.
They are used to maintain internal records, to
present data to customers and clients on the
World-Wide-Web, and to support many other
commercial processes. Databases are likewise
found at the core of many modern organizations.
Prone to error
Difficult to update, retrieve, integrate
You have the data but it is difficult to compile
the information
Limited to small size information
Cross referencing is difficult
a) Sophisticated Users
Are users familiar with the structure of the
Database and facilities of the DBMS.
Have complex requirements
Have higher level queries
Are most of the time engineers, scientists,
business analysts, etc
a) Casual Users
Users who access the database occasionally.
Need different information from the database
each time.
Use sophisticated database queries to satisfy
their needs.
Are most of the time middle to high level
managers.
Users may be divided into those who actually
use and control the database content, and those
who design, develop and maintain database
applications(called “Actors on the scene”), and
those who design and develop the DBMS and
related tools, and the computer systems
operators(called “Workers behind the scene”). eg
of“ Actors on the Scene”.
Actors On the Scene:
Data Administrator
Database Administrator
Database Designer
End Users
Workers behind the Scene
Debre Markos Polytechnic college Dessie A.
25
Design a Database
Department
Employee Job
Department Job
Employee
Activity
Time Card
Implementation
Operation and Support
From these different phases, the prime interest of a
database system will be the Design part which is
again sub divided into other three sub-phases.
These sub-phases are:
1. Conceptual Design
2. Logical Design, and
3. Physical Design
In general, one has to go back and forth
between these tasks to refine a database
design, and decisions in one task can influence
the choices in another task.
In developing a good design, one should answer
such questions as:
What are the relevant Entities for the
Organization
What are the important features of each
Entity
What are the important Relationships
What are the important queries from the
user
What are the other requirements of the
Organization and the Users
The Three levels of Database Design
Conceptual Design
Logical Design
Physical Design
Conceptual Database Design
Conceptual design is the process of
constructing a model of the information used in
an enterprise, independent of any physical
considerations.
It is the source of information for the logical
design phase.
Mostly uses an Entity Relationship Model to
describe the data at this level.
After the completion of Conceptual Design one
has to go for refinement of the schema, which
is verification of Entities, Attributes, and
Relationships
Logical Database Design
Logical design is the process of constructing a
model of the information used in an enterprise
based on a specific data model (e.g. relational,
hierarchical or network or object), but
independent of a particular DBMS and other
physical considerations.
Normalization process
Collection of Rules to be maintained
Discover new entities in the process
Revise attributes based on the rules and
the discovered Entities
Debre Markos Polytechnic college Dessie A.
50
Design a Database
o Entities
Corresponds to entire table, not row
Represented by Rectangle
o Attributes
Represents the property used to
describe an entity or a relationship
Represented by Oval
o Relationships
Represents the association that exist
between entities
Represented by Diamond
o Constraints
Represent the constraint in the data
Before working on the conceptual design of
the database, one has to know and answer
the following basic questions.
What are the entities and relationships in the
enterprise?
What information about these entities and
relationships should we store in the database?
What are the integrity constraints that hold?
Constraints on each data with respect to
update, retrieval and store.
Represent this information pictorially in ER
diagrams, then map ER diagram into a
relational schema.
Developing an E-R Diagram
Designing conceptual model for the database is not
a one linear process but an iterative activity where
Debre Markos Polytechnic college Dessie A.
52
Design a Database
Id Gpa
Students Courses
Age
Enrolled_In Semester
Academic
Year
Grade
One-To-Many Relationships
Many-To-Many Relationship
A customer is associated with several (possibly 0)
loans via borrower
A loan is associated with several (possibly 0)
customers via borrower
Problem in ER Modeling
The Entity-Relationship Model is a conceptual data
model that views the real world as consisting of
entities and relationships. The model visually
represents these concepts by the Entity-
Relationship diagram. The basic constructs of the
ER model are entities, relationships, and attributes.
Entities are concepts, real or abstract, about which
information is collected. Relationships are
associations between the entities. Attributes are
properties which describe the entities.
Debre Markos Polytechnic college Dessie A.
59
Design a Database
Semantics
Bra1
descriptionCar1
of the problem; Emp1
Car2
Bra2 Emp2
Car3
Bra3 Emp3
Car4
Bra4 Emp4
Car5
Emp5
Car6
Emp6
Car7
Emp7
2. Chasm Trap:
Occurs where a model suggests the existence
of a relationship between entity types, but the
path way does not exist between certain entity
occurrences.
May exist when there are one or more
relationships with a minimum multiplicity on
cardinality of zero forming part of the pathway
between related entities.
Debre Markos Polytechnic college Dessie A.
61
Design a Database
Example:
1..1 Has 1..* 0..1 Manages 0..*
Branch Employee project
If we have a set of projects that are not active
currently then we can not assign a project
manager for these projects. So there are project
with no project manager making the
participation to have a minimum value of zero.
Problem:
How can we identify which BRANCH is
responsible for which PROJECT? We know that
whether the PROJECT is active or not there is a
responsible BRANCH. But which branch is a
question to be answered, and since we have a
minimum participation of zero between
employee and PROJECT we can’t identify the
BRANCH responsible for each PROJECT.
The solution for this Chasm Trap problem is to
add another relation ship between the extreme
entities (BRANCH and PROJECT)
This table is not in first normal form because the [Color] column
can contain multiple values. For example, the first row includes
values "red" and "green."
To bring this table to first normal form, we split the table into
two tables and now we have the resulting tables:
This table has a composite primary key [Customer ID, Store ID].
The non-key attribute is [Purchase Location]. In this case,
[Purchase Location] only depends on [Store ID], which is only
part of the primary key. Therefore, this table does not satisfy
second normal form.
To bring this table to second normal form, we break the table
into two tables, and now we have the following:
In the table able, [Book ID] determines [Genre ID], and [Genre
ID] determines [Genre Type]. Therefore, [Book ID] determines
[Genre Type] via [Genre ID] and we have transitive functional
dependency, and this structure does not satisfy third normal
form.
To bring this table to third normal form, we split the table into
two as follows:
a 1NF database.