You are on page 1of 25

DATABASE DESIGN

STAGES
Ivan Bamweyana
LSG 2102
Data and data modelling
Data is the heart of a GIS; not only must the correct
data be captured, but it must be properly structured and
stored for access

Spatial database design involves identifying the


required geographic phenomena and choosing an
appropriate data representation

The process of identifying the structure of an


information system (the database) as the basis for
employing functions (statements for data retrieval) on
the data is referred to as data modelling
Spatial database design
• Identify the required geographic phenomena

• Choose an appropriate data representation

▪ understand the problem

▪ identify the processes and functions to be modelled

▪ determine what data are required and or available


Database Design – Iterative process

Database design traditionally Reason: rules and operations


focusses on the first of the are defined in terms of the
triplet that must be defined: the chosen structure, so can only
be done afterwards
choice of storage structures.

Design of rules and operations


is important too! And will affect Hence iterative process
the choice of data structure
also.
Database Design
• Is a difficult, and error-
prone process: early
mistakes in the design
Design
Phase
Concerns fire back in later
External Data requirements of individuals and stages.
(conceptual) level groups of users

Logical level Integration of all external data • Phases are recognised


requirements
Identification (possibly resolution) of
data redundancy
to accommodate
Physical level Performance in time / space separation of
concerns:
Database Architecture
• Many views, single conceptual,
logical and physical schema.
➢ Views describe how
users see the data- what users see is
not necessarily the same, The idea is
that users’ views are separate to the
way data is physically stored
➢ A combination of Conceptual and
logical
schemas define integrated logical
structure. Describes the data and
relationships between them
➢ Physical schema describes
the files and indexes used. How the
data is stored in the database
(collection of records)
• Overall description is the database schema
Database Architecture
• Data independence:
upper levels are
unaffected by the
lower level changes
• The DBA can change
“design” without
affecting external view;
• The DBA can change
storage structures
without affecting
external view;
Conceptual, Logical and Physical Data
Models
• Frequently used in data modelling to differentiate levels of
abstraction versus detail in the model
• The conceptual model is concerned with the real world
view and understanding of data;
• The logical model is a generalized formal structure in the
rules of information science;
• The physical model specifies how this will be executed in
a particular DBMS instance.
• Logical models ties the conceptual and physical data
models together!
Entity – Relationship Diagram (ERD)
Most common data modelling approach

The foundation of conceptual data modelling

Displays entities (objects, nouns or things that the business is


interested in) as boxes and relationships

Uses boxes for entities and lines to show the relationships

Independent of hardware and software

Entity
Notation uses three main Relationship
constructs Attributes
Entities
• Central concept of the ERD, also known as object or data
object
• A real world feature or phenomena (e.g. people, buildings,
land value, contour etc.)
• An entity has a unique name, represented by rectangle

Lecturer
Student
Hall of Residence
Attributes
• Particular characteristics or property of an entity
• Attributes are represented by oval/ellipses and are
connected to the entity rectangle with a line
▪ Required attribute (“NOT NULL”) (must have a value and cannot be
left empty, e.g. first & last name of a person). Same as primary key
▪ Optional attribute (does not require any value, therefore, it can be left
empty, “middle name”).
• Simple or composite 11/U
• Single-valued and multi-valued
• Derived
• Keys
Conceptual Data Model
• A conceptual data model identifies the highest-level
relationships between the different entities.
• Features of conceptual data model include:
➢ Important entities and the relationships among them.
➢ No attribute is specified.
➢ No primary key is specified.
➢…
• Only information shown via the conceptual data model is
the entities that describe the data and the relationships
between those entities
Conceptual Data Model
A logical data model describes the
Logical Data data in as much detail as possible,
Model without regard to how they will be
physically implemented in the
database.

Features of a logical data model


include:
Foreign keys
(keys identifying
All entities and All attributes for The primary key Normalisation
the r/ship
relationships each entity are for each entity is occurs at this
between different
among them specified specified level
entities) are
specified
Logical Data Model
• The steps for designing the logical data model are as
follows
1. Specify primary keys for all entities
2. Find the relationships between different entities
3. Find all attributes for each entity
4. Resolve many to many relationships - redundancy
5. Normalisation
• Types of relationships:
➢ one to one (1:1)
➢ one to many (1:N)
➢ many to many (M:N)
➢ Many to one (M:1)
Logical Data Model

Logical Database
Elements Elements
Object Row
Attribute Column, Field
Class Table
Logical Data Model
Logical Data Model
Comparison of Conceptual and logical
data model
Conceptual Logical
• No primary key is present • Presence of primary keys
• No attributes are specified • All attributes specified
within an entity
• Relationships are simply • Relationships between
stated not specified entities are specified
Physical Data Models
• Represents how the model will be built in the database
• shows all table structures, including column name,
column data type, column constraints, primary key, foreign
key, and relationships between tables.
• Features of a physical data model include:
➢ Specification all tables and columns.
➢ Foreign keys are used to identify relationships between tables.
➢ Denormalisation may occur based on user requirements.
• Physical considerations may cause the physical data
model to be quite different from the logical data model.
• Physical data model will be different for different RDBMS.
For example, data type for a column may be different
between MySQL and SQL Server.
PHYSICAL DATA
MODELS
The steps for physical data model design are as follows:
1. Convert / entities / classes into tables.
2. Convert relationships into foreign keys.
3. Convert attributes into columns.
4. Modify the physical data model based on physical
constraints / requirements.
COMPARISON OF LOGICAL
AND PHYSICAL DATA MODELS
With the physical data model,

➢Entity names are now table names.

➢Attributes are now column names.

➢Data type for each column is specified.

• Remember, data types can be different depending on the actual DBMS


being used
Comparison (existence) of different features
within the three models
Feature Conceptual Logical Physical
Entity Names ✓ ✓

Entity Relationships ✓ ✓

Attributes ✓

Primary Keys ✓ ✓

Foreign Keys ✓ ✓

Table Names ✓

Column Names ✓

Column Data Types ✓


Summary
• Complexity increases from conceptual to logical to physical
1. Conceptual data model - helps understand at high level
what the different entities in our data are and how they
relate to one another
2. Logical data model – helps understand the details of our
data without worrying about how they will actually
implemented
3. Physical data model – helps know exactly how to
implement our data model in the database of choice
• sometimes the conceptual data model and the logical data
model are considered as a single deliverable.
• Just like the logical and physical data model could be
presented as the same deliverable.

You might also like