Database Modelling & Design (Chap 1 - 3)
Database Modelling & Design (Chap 1 - 3)
Lecture Notes
Contents
I. Database Systems and the Life Cycle (Chapter 1)……………………2
Introductory concepts; objectives of database management 2
Relational database life cycle 3
Characteristics of a good database design process 7
II. Requirements Analysis (Chapter 3)………………………………….8
Prepared by:
Eng. TANG Lineker
1
I. Database Systems and the Life Cycle
Introductory Concepts
data—a fact, something upon which an inference is based (information or knowledge has
value, data has cost)
data item—smallest named unit of data that has meaning in the real world (examples: last
name, address, ssn, political party)
data aggregate (or group) -- a collection of related data items that form a
whole concept; a simple group is a fixed collection, e.g. date (month, day, year); a
repeating group is a variable length collection, e.g. a set of aliases.
record—group of related data items treated as a unit by an application program (examples:
presidents, elections, congresses)
database administrator (DBA) -- person or group responsible for the effective use of
database technology in an organization or enterprise. Motivation: control over all phases of
the lifecycle.
2
5. Data independence (a relative term) -- avoids reprogramming of applications, allows
easier conversion and reorganization
* physical data independence—program unaffected by changes in the storage structure or
access methods
*Y2K (year 2000) problem—many systems store 2-digit years (e.g. ‘02-OCT-98’) in their
programs and databases, that give incorrect results when used in date arithmetic (especially
subtraction), so that ‘00’ is still interpreted as 1900 rather than 2000. Fixing this problem
requires many hours of reprogramming and database alterations for many companies and
government agencies.
3
4
5
6
Characteristics of a Good Database Design Process
* iterative requirements analysis
- interview top-down
- use simple models for data flow and data relationships
- verify model
7
II. Requirements Analysis
1. Organizational objectives
- sell more cars this year
- move into to recreational vehicle market
3. Organizational structure/chart
8
Data and Process Dictionary Entries for Requirements Analysis
in the Database Design Lifecycle
Entity Description (possibly in a data dictionary)
Name customer
Reference-no 4201
Cardinality 10,000
Growth rate 100 per month
Synonyms user, buyer
Role (or description) someone who purchases or rents a
product made by the company.
Security level 0 (customer list is public)
Subtypes adults, minors
Key attribute(s) cust-no
Non-key attribute(s) cust-name, addr, phone, payment-status Relationship to
other entities salesperson, order, product
Used in which applications billing, advertising
Attribute description (data elements in a data dictionary)
Name cust-no
Reference-no 4202
Range of legal values 1 to 999,999
Synonyms cno, customer-number
Data type integer
Description customer id number set by the company.
Key or nonkey key
Source of data table of allowable id numbers
Used in applications billing
Attribute trigger /*describes actions that occur when a
data element is queried or updated*/
Relationship description
Name purchase
Reference-no 511037
Degree binary
Entities and connectivity customer(0,n), product(1,n)
Synonyms buy
Attributes (of the relationship) quantity, order-no
Assertions a customer must have purchased at
least one product, but some products
may not have been purchased as yet by
any customers.
Process (application) description
Name payroll
Reference-no 163
Frequency bi-weekly
Priority 10
Deadline noon Fridays
Data elements used emp-name, emp-salary
Entities used employee
Data volume (how many entities) implicit from entity cardinality
9
Interviews at different levels
Top management - business definition, plan/objectives, future plans
Middle management - functions in operational areas, technical areas, job-titles, job functions
2. Agree with the interviewee on format for documentation (ERD, DFD, etc.)
Function: Take customer orders and either fill them or make adjustments.
Frequency: daily
10
III. Entity-Relationship (ER) Modeling
Entity - a class of real world objects having common characteristics and properties about
which we wish to record information.
* degree - number of entities associated in the relationship (binary, ternary, other n-ary)
* Surrogate - system created and controlled unique key (e.g. Oracle’s “create sequence”)
11
12
13
14
Super-class (super-type)/subclass (subtype) relationship
Generalization
* similarities are generalized to a super-class entity, differences are specialized to a subclass entity,
called an “ISA” relationship (“specialization” is the inverse relationship)
* special property: inheritance - subclass inherits the primary key of the super-class, super-class has
common nonkey attributes, each subclass has specialized non-key attributes
Aggregation
* “part-of” relationship among entities to a higher type aggregate entity (“contains” is the inverse
relationship)
15
Constraints
16
Constraints in ER modeling
* role - the function an entity plays in a relationship
- mandatory/optional
- specifies lower bound of connectivity of entity instances
- participating in a relationship as 1 or 0
17
18
19
20
21