2. Phases of Database Design
Data
Requirements
Conceptual design begins with the
Specification of requirements
and results
collection of requirements and results
Conceptual
needed from the database (ER Diag.)
Design
Logical schema is a description of the
Conceptual Schema structure of the database (Relational,
Logical Network, etc.)
Design
Physical schema is a description of
Logical Schema
the implementation (programs, tables,
Physical
Design
dictionaries, catalogs
Physical Schema
2
3. Models
A data model is a collection of objects that
can be used to represent a set of data and
operations to manipulate the data
Conceptual models are tools for representing
reality at a very high-level of abstraction
Logical models are data descriptions that can
be processed by computers
3
4. Conceptual model:
Entity-Relationship Diagrams
Entities represent classes of real-world
objects. Person, Students, Projects, Courses
are entities of a University database
Relationships represent interactions
between two or more entities
N 1
Lives_In
Person City
Is_Born_In
N 1 4
5. Example:
Every employee works in at least one
project
Every project has employees working on it.
EMPLOYEE
N N PROJECT
SSN
WORKS_ON Name
Name
Code
Salary
5
6. Higher-Order Relationships
A relationship may involve more than two
entities
Course Meets Classroom
Day
6
7. Recursive relationships
Relationships could be mapped from one
entity to itself
Manager_Of
1
Employee Manages
N
Subordinate_To
7
8. Attributes
Attributes represent elementary properties of the
entities or relationships. The stored data will be
kept as values of the attributes
Lives_In
N 1
CITY
PERSON Moving_Date
Name
Ssn
Country
Name Birth_Date
Profession Elevation
Population
Is_Born_In
N 1 8
9. Generalizations
• An entity could be seen from many different viewpoints
• Each viewpoint defines a set of roles in a generalization
• Example below uses SEX to classify the object “Person”
PERSON
Ssn
Name
Address
MAN FEMALE
Draft_Status Maiden_Name
9
10. Generalizations
A classification could be disjoint or
overlapping
An entity could have more than one
classification PERSON
Ssn
Name
Address
SEX JOB
Full_Time Part_Time
MAN FEMALE
Annual_Salary Hour_Rate
Draft_Status Maiden_Name
Department Weekly_Hours
10
11. Example: Department Store 1/2
A department store operates in several
cities
In a city there is one headquarter
coordinating the local operations
A city may have several stores
Stores hold any amount of items
Customers place their orders for any
number of items to a given store
GOAL: Optimize shopping in each city 11
12. Example: Department Store 2/2
STORES 1 CITIES
Store ID N LOCATED City Name
Address IN State
Manager ID HeadQtr Address
N
N
CUSTOMER
Customer Name
Address
HOLD IN-CITIES
Phone Number
Qty Held Qty_in_cities
N N
1
ITEMS
Item ID N N ORDERS N
ITEMS ORDERED
Description Order Number PLACE
Qty Ordered
Size Order Date
Color
12
13. Example: University Database
Professors work for only one department
Departments have many professors
Each course is taught by only one professor
Students make a plan or program of study
A course could meet in several rooms/times
Graduate students must have an advisor
Cities are categorized as resident/BirthPlace
Visiting prof. need an End/Start date
13
14. University Database
CITY 1 N PERSON DEPARTMENT 1
Name BIRTH_PLACE LastName Name Belongs_To
State Age Phone
N
N
RESIDENT N
PROFESSOR
STUDENT TenureStatus
Title
N
N
1
VISITING_
ENROLLED PLANNED N PROFESSOR
GRADUATE_STUDENT ADVISED_BY Start_Appointment
Semester Semester
Grade End_Appointment
N
N
COURSE
N 1
Title TAUGHT_BY
Description Semester
Credits
1
TIME N N ROOM
Day MEETS RoomNumber
Hour Building
University database 14
15. Soccer Database
A team has players, one coach, fans
Teams play according to a schedule
Teams need to practice in a Stadium
Attendance and scores must be recorded
15
16. Soccer Database
PERSON
Ssn
Name
Address
FAN
PLAYER COACH
Name
Uniform_Size Personal Record
Address
Shoe_Size Years Experience
Favorite Bar
N N 1
PLAYS
SUPPORTS MANAGES
_FOR
1 1
N
TEAM
Name
Location
Phone
N
N N PRACTICES
PLAY_
AGAINST
N
GAME
STADIUM
Number TAKES
Name
ATTENDS Attendance PLACE
Address
N N
Final Score N AT 1 Capacity
16
Date
17. Research Project Database
Some employees are researchers
Every project has a leader investigator
Every project must be funded by an agency
A project may include several topics
A topic could appear in several projects
Researchers must produce report(s)
Each employee must have a supervisor
17
18. Research Projects Database
RESEARCH REPORT
Number
Title
1 SUPERVISE N
N N S
ADDRESSES PRODUCES
N N
EMPLOYEE
RESEARCH PRINCIPAL SSN
RESEARCH TOPIC N N INVESTIGATOR1 Name
PROJECT 1
Code ON N Title
Name
Name
Code
WORKS
N _ON
N
FUNDED_BY
N
Amount
Date
Grant#
N
AGENCY
Name
Address
Contact Person 18
19. Contract-Supplies System 1/3
A company negotiates contracts with
suppliers to provide certain amount of items
at a fixed price
Orders are placed against any of the already
negotiated contracts
A contract could provide items to any
number of orders
19
20. Contract-Supplies System 2/3
An order may include any number of items
negotiated in the contract
Orders should not exceed the maximum
amount of items quoted in the contract
All items in an order must be provided as
part of a single contract and a single project
20
21. Contract-Supplies System 3/3
SUPPLIERS
Supplier Number
Name
Address
1
PROJECTS
NEGOTIATE
Project Number
Date of Contract
Project Data
N
1
CONTRACTS 1 N
Contract Number SUPPLIED AS
Text
NEEDED BY
N
TO SUPPLY N
Contract Price
Contract Amount
N
ORDERS
ITEMS N N
MADE OF Order Number
Item Number
Order QTY Date Required
Description
Date Completed
21
22. Manufacturing: Requisitions 1/3
Projects are broken into tasks
Tasks are assigned to departments
A task is created for one project and
assigned to one department
Requisitions are made for projects
Each requisition could ask for any number
of items
22
23. Manufacturing: Requisitions 2/3
Each requisition is for one project and is
made to one supplier
Items could be: equipment or materials and
are coded in a similar way
Suppliers send periodic price notices to
advise the company of any changes in their
prices
23
24. Manufacturing: Requisitions 3/3
PROJECTS 1 N TASKS
Project Number MADE OF Task Number
Project Data Task Data
1 1
REQUESTS FOR
N
N
SUPPLIERS
REQUISITION
N 1 Supplier
Item Number FROM
Number
Qty Requested
Supplier Data
N 1
CONTAINS SENDS
N N
ITEMS 1 N PRICE ADVICE
Item Number CHANGES Price
Item Data Effective Date
MATERIAL ITEM
EQUIPMENT ITEM
Code
Code
Description
Description
Weight 24
Container
25. Job-Shop Accounting System 1/4
The system is used by a company that
manufactures special-purpose assemblies
for customers
To manufacture assemblies the company
creates a sequence of processes (steps)
Each process is supervised by a department
Assume there are three type of processes:
PAINT, FIT, CUT
25
26. Job-Shop Accounting System 2/4
During manufacturing an assembly could
pass through any sequence of processes, in
any order; it may pass through the same
process more than once
A unique Job# is given to any new
assembly.
Costs and started-terminated dates must be
recorded
26
27. Job-Shop Accounting System 3/4
Anaccounting system is used to keep track
expenditure for each:
DEPT,
PROCESS,
ASSEMBLY
Asa job proceeds, cost transactions can be
recorded against it.
27
28. Job-Shop Accounting System 4/4
CUSTOMER ACCOUNTS
S Account ID
Customer ID Date
Address Established
A1
ASSEMBLY DEPT PROCESS
ORDERS ACCOUNTS ACCOUNTS ACCOUNTS
T1
Account 1 Account 2 Account 3
Details Details Details
TRANSACTIONS
T2
ASSEMBLIE A2
S
Assembly ID T3
Date Ordered DEPARTMENT
Details S
ACTIVITY Dept Number
MADE AS Dept Data
USED IN A3
JOBS
Job Number
Starting Date USES
Ending Date PROCESSES
Total Cost Process ID
Process Data
CUT JOBS
PAINT JOBS
Cut Job ID
FIT JOBS Paint Job ID
Machine type
Fit Job ID Color
used
Labor time Volume CUT PROC
Material used PAINT PROC FIT PROC
Labor time Cut Proc ID 28
Laor time Paint Proc ID Fit Proc ID
Cuttong Type
Paint Method Fit Type
Machine Type