Professional Documents
Culture Documents
Class Outline
Database Models
Database Design Problems
Conceptual Design Methodology
Break
Database Models
Database Models
Database Models
A Hierarchical Structure
Database Models
Database Models
Conceptual simplicity
Database security
Data independence
Database integrity
Efficiency dealing with a large database
Disadvantages
Complex implementation
Difficult to manage
Lacks structural independence
Applications programming and use complexity
Implementation limitations
Lack of standards
Database Models
Database Models
Conceptual simplicity
Handles more relationship types
Data access flexibility
Promotes database integrity
Data independence
Conformance to standards
Disadvantages
System complexity
Lack of structural independencem
Database Models
Relational database
Database Models
Database Models
Advantages
Disadvantages
Clients
Instruments
Entertainers
Engagements
Entertainer styles
Database Models
Database Models
Database Models
Database Models
Database Models
Disadvantages
Limited constraint representation
Limited relationship representation
No data manipulation language
Loss of information content
Tables
Relationships
Database Terminology
Table
Users view their data in two-dimensional tables.
table
file
relation
Field
The fields within records contain data. Data within a field
must be of the same data type. Each field within a table
must have a unique name. Order of fields is unimportant.
column =
field
attribute
Record
A record is a group of related fields of information about a
single instance of one object or event in a database.
Tables consist of zero, one, or more records.
Order of rows is unimportant.
row
record =
tuple
Keys
Keys
Indexes
Integrity Rules
Database Components
Tables
Queries
Forms
Reports
Modules
external
conceptual
internal
Redundancy
Multi-valued problems
Update anomalies
Insertion anomalies
Deletion anomalies
Redundancy
Multi-valued problems
Multi-valued problems
Multi-valued problems
Update Anomalies
Update Anomalies
Insertion anomalies
Deletion anomalies
Class Outline
Database Models
Database Design Problems
Design Exercise
Break
A good designer combines the art of design with the science of design.
Statement of Purpose
1. Declare a specific purpose for the database to
focus and guide its development
interview transcripts
meeting minutes
observational notes
questionnaire results
document analyses
business forms
reports
flow charts
presentations
computer-generated
output
training manuals
consultant reports
job descriptions
Arbitrate disputes
Data Modeling
Connectivity
Entities
M : N
Relationship
Type
Participation
Objects
Cardinality
Relationships
Degree
Recursive
Binary
Domains
Attributes
Values
1 : N
Ternary
N-ary
Mandatory
Optional
Entities
Entity
Entity Instance
STUDENT
Attributes
phone #
first name
last name
STUDENT
photo
birth date
Identifiers
STUDENT
StudentID, ...
Relationships
Usually a verb
HAS-A is also a common relationship
(EMPLOYEE-has a-DEPENDENT)
E-R model also contains relationship classes
STUDENT
StudentID, ...
takes
COURSE
CourseID, ...
VACATIONER
EMPLOYEE
takes
works
for
TRIP
DEPARTMENT
WRITER
ILLUSTRATOR
CUSTOMER
WAREHOUSE
create
order
DESIGNER
ITEM
TEAM
COURSE
plays
requires
Recursive Relationships
Connectivity
One-to-Many
Child
One-to-One
Employee
Many-to-Many
Musician
1
1
M
rents
has
sings
M
1
N
Toy
Office
Song
STUDENT
STUDENT
1 M
Date
enrolls in
enrolls in
CLASS
1
Mark
CLASS
Cardinality
e.g., at a toy lending library, a given child may not borrow any toys
at all or they may borrow more than one (up to 3) toys. A toy may
not be borrowed by anyone, or it may be borrowed by one child.
Child
1
(0,3)
borrows
M
(0,1)
Toy
Occurrences Diagram
Pictorial mapping of the occurrences between two entities
assists in understanding connectivity and cardinality
C1
T1
C2
T2
C3
T3
C4
T4
C5
T5
Relationship Participation
Also referred to as minimum cardinality
Mandatory Participation
An instance of a given entity must definitely match an
instance of a second entity
e.g., each student must enroll in exactly one course
Optional Participation
An instance of a given entity does not necessarily
participate in the relationship
lower bound of cardinality is zero
e.g., a faculty member teaches zero, one, or two
courses
1
N
DONATION
MEMBER
makes
MANDATORY
(0,N)
(1,1)
OPTIONAL
CUSTOMER
makes
(0,N)
ORDER
(1,1)
common field
parent table
related
table
Entity-Relationship Design
BOOK
PUBLISHER
AUTHOR
writes
BOOK
PUBLISHER
publishe
s
BOOK
Each book is written by how many authors? Each author writes how many books?
Each book may be authored by zero (anonymous), one, or more than one author and each author
may write zero, one, or more than one book. The relationship type is many-to-many or:
AUTHOR
writes
BOOK
PUBLISHER
publishe
s
BOOK
AUTHOR
writes
(0, N)
BOOK
(0, N)
PUBLISHER
1
(0, N)
publishe
s
BOOK
(1,1)
AUTHOR
M
AuthorID, ... (0,N)
writes
N
(0,N)
ISBN, ...
BOOK
(1,1)
publishes
1
PUBLISHER
PublisherID, ...
(0,N)
AUTHOR
writes
BOOK
(0,N)
(0,N) (1,1)
(1,1)
AuthorID, ...
AuthorID,ISBN, ... ISBN, ...
M (1,1)
publishes
1 (0,N)
PUBLISHER
PublisherID, ...
COURSE
STUDENT
teaches
COURSE
STUDENT
takes
COURSE
F1
F2
F3
F4
F5
C1
C2
C3
C4
C5
S1
S2
S3
S4
S5
C1
C2
C3
C4
C5
FACULTY
teaches
COURSE
STUDENT
takes
COURSE
FACULTY
teaches
(0,2)
COURSE
(0,3)
STUDENT
M
(1,6)
takes
N
(0,30)
COURSE
M
COURSE
(0,3)
CourseID, ...
taught by
(0,2)
FACULTY
FacultyID, ...
taken by
(0,30)
STUDENT
(1,6)
StudentID, ...
You are now told that in addition to the relationships given, each
student is assigned a faculty advisor who gives direction in
choosing courses.
Use occurrences diagram to visualize relationship between entities
We are told each student is advised by exactly one faculty
advisor. We can assume that each faculty member advises zero,
one, or more students. This means the additional relationship is
of type one-to-many or 1:M.
The STUDENT is on the many side of the relationship and must be
advised therefore, faculty is mandatory to student; FACULTY on
the one side of the relationship may or may not have a student,
therefore student is optional to faculty.
1
FACULTY
(0,N)
advises
M
STUDENT
(1,1)
1 M
STUDENT
M
(1,1)
StudentID, ...
(1,6)
takes
(1,1)
M1
COURSE
(1,1)
(0,30)
ad
vi
se
s
CourseID, ...
1 (0,3)
M (1,1)
taught
by
M (1,1)
1 (0,2)
(0,N)
1
FACULTY
FacultyID, ...