Professional Documents
Culture Documents
University of Manitoba
B Asper School of Business
3500 DBMS
Bob Travica
S
Y Chapter 2
S Database System Design
(part II)
T
E Based on G. Post, DBMS: Designing & Building Business Applications
M Updated 2020
S
1
D Part-Whole Relationship: Aggregation
B
Sale Item
SaleID * contains * ItemID
SaleDate Description
S EmployeeID listPrice
Y • Many-to-many relationship:
S Each sale transaction contains many items, and each item can be
included in many sale transactions (provided items are keyed generically -
M Sale1 ItemA
ItemB
Note: This is called instance diagram
and it might help you with visualizing
Sale2 multiplicity.
S ItemC
D Part-Whole Relationship: Composition
B Two ways of displaying composition:
A B
Wheel Bicycle
Association between the WheelID
2
S whole class (Bicycle) and
part classes (Wheel,
Rim
Spoke
Size
Model Type
… …
Y Crank and Stem).
1
Crank
Wheel
S part of CrankID
Weight
Crank
T Bicycle
BicycleID
Stem
1
E Size
Model Type StemID
Weight
Stem
…
M Size
• The whole class is composed from part classes—it does not exist without certain parts.
S • Parts have purpose as the parts of a specific whole—they live and die with the whole.
• Therefore, part classes and whole class are tightly coupled.
• Typical use: Manufacturing, bill-of-materials
D Generalization
B
Association between the Animal Example: Modeling data
Superclass (Animal) and AnimalID on animals sold in a pet
Sub-Classes (Mammal, Fish, DateBorn store.
S Spider). Name
Gender
Y ListPrice
{disjoint}
S is_a Is_a Is_a
– Polymorphism (variation of
M parent’s methods in children)
PayInterest BillOverdraftFees
1 1 1
S Supplier Employee
1 *
Sale
* 1
Customer
T 1 1 *
* *
E Merchandise
PurchaseOrder
MerchOrderItem
SaleItem
M *
*
*
Merchandise keyed
S generically.
Merchandise
Y PurchaseOrder
<
lls
ha
T
lfi
nd
fu
l
es
1 1 M
S M Supplier Employee
1 *
1
Sale * 1
M
Customer
handles made to
T 1
handles
1 T *
fulfills
E *
Merchandise
PurchaseOrder
*
MerchOrderItem
T
includes
SaleItem
M T incl *
ud e *
M * T
s
S Merchandise
• Note that master classes usually connect via transactional classes, not directly.
D Pet Store Schema (Normalized Tables Diagram)
B
S
Y
S
T
E
M
S Differences from class diagram:
-Associations not named
-Association classes became tables related to source classes
-Association between source classes disappeared
D Data Types ("Domains")
B
Format of data and range of values.
Data Type Access SQL Server Oracle
S Text
fixed
variable Text
char, nchar
varchar, nvarchar
CHAR
VARCHAR2,NVARCHAR2
Y memo
Number
Memo text, ntext LONG
T
(64 bits) NA bigint NUMBER
Fixed precision dec. NA decimal(p,s) NUMBER(127, 0)
Floating Float real NUMBER, FLOAT [movable dec. point]
S /Age
Phone
from a historical start to date minus
the number of seconds from that start to
birth date)
…
T
E • Common example in business DB system:
M Sum=Item’s Sale Price * Quantity Sold
S
D Rolling Thunder Bicycles: Package View
B
Sales Bicycle Assembly
S
Y
S Employee
T
E Location Purchasing
S BalanceDue
Retail Store
From Bicycle package
T
0..1
Customer StoreID
Transaction StoreName
S Reference CityID