Database Design

advertisement
Information Systems Design
Database Design
Max J. Egenhofer
University of Maine
Orono, USA
max@spatial.maine.edu
http://www.spatial.maine.edu/~max
Conceptual Schema
• Captures the essential data that
need to be stored and the
relationships among entities
• Conceptual schema often first handdrawn (sketched)
• Design process typically uses some
basic conventions to formulate the
schema
First Crack at
Conceptual
Schema Design
• named entities (boxes)
named relationships between
entities
person
car
First Crack at
Conceptual
Schema Design
• named entities (boxes)
• named relationships between
entities (arrows)
person
owns
car
Entities
• Entities are classes, not individuals
• A class is an abstraction for several individuals that
all share common properties
• from Sara, John, Henry to student
• from Paul and Jake to graduateStudent
Entity-Relationship
Diagrams
Peter Chen
•
• relationships as diamonds
classes as rectangles
person
name
linked to boxes
livesIn
date
town
name
• attributes as ovals linked to
boxes (or relationships)
zipCode
ER Diagrams
• primarily a graphical language
(with text as labels)
• alphabet
• syntax rules
• appropriate for small miniworlds
Design a
Simple Schema
for a College Course
• Name the entities
• Capture their relationships
3-Schema Architecture
database user
Views
Interfaces
ExternalView
Application
External-Conceptual
mappings
database designer
Conceptual
Logical
View
Objects
Relationships
Conceptual-Internal
mappings
database implementor Physical
Internal
View
Data structures
(B+-trees, Hash tables)
Files
Records
many
one
one
Why such a Separation?
Allow a database designer to
describe the model without
having to worry about
implementation aspects
therefore, conceptual schema
outside DBMS
conceptual
schema
DBMS
Why such a Separation?
To enable a generic storage and
retrieval mechanism (i.e., the
DBMS software) that will work
for any kind of specific
application
therefore, physical schema at
the interface to the storage
medium
conceptual
schema
DBMS
physical
schema
Why such a Separation?
To streamline discussions of the
model vs. DBMS-specific
implementation aspects
therefore, separation of logical
from physical schema
conceptual
schema
logical
schema
DBMS
physical
schema
Why such a Separation?
To enable multiple user
communities to use the same
database
therefore, addition of external
schemas as interfaces to DBMS
external external external
schema schema schema
DBMS
Saber
Logical Level
• Follows the model laid out in the
conceptual schema
• Expresses the conceptual model in the
data model of the DBMS
• Through the DBMS’s data definition
language (DDL) the logical model is fed
into the database
Physical Level
• Storage in bits and bytes
• Refers to data wrt. location on physical device
• different physical addresses when items are
moved around
• on same device
• onto different device
• Concerned with performance (speed) of
retrieval
IS Designer’s Perspective
conceptual (cognitive)
formalize
logical
implement
physical
DB Administrator’s View
views
derived logically
logical
valid implementation?
physical
Successful DB Design
conceptual
compatible
logical
physical
views
DB Design and Use
Conceptual Schema Design
Translation of DB Schema
from conceptual to logical level
Population of DB with data
DB query and analysis
Languages for
DB Design and Use
Conceptual Schema Design
UML (Universal Modeling Language)
Translation of DB Schema
from conceptual to logical level
DDL (data definition language)
Population of DB with data
DML (data manipulation language)
DB query and analysis
query language (e.g., SQL)
Download