Introduction To Database Design: San Diego Supercomputer Center
Introduction To Database Design: San Diego Supercomputer Center
Introduction To Database Design: San Diego Supercomputer Center
Database Design
•Users
•Legacy Systems/Data
•Application Requirements
Employee Department
Employee Department
one-to-many
1 N
Department has Project
many-to-many
M N
Employee works on Project
1 N
Games play Players
1 1
Games generates Sales
Games
1 1
play generates
N 1
Players Sales
Name
IT has 3 employees:
Employee Ajay Patel
John O’Leary
emp_no dept_no Name
Julia Lenin
1 2 Nora Edwards
2 3 Ajay Patel
3 2 Ben Smith
4 1 Brian Burnett
5 3 John O'Leary
6 3 Julia Lenin
Employee
Employee (1NF)
emp_no name dept_no dept_name skills
1 Kevin Jacobs 201 R&D C
1 Kevin Jacobs 201 R&D Perl
1 Kevin Jacobs 201 R&D Java
2 Barbara Jones 224 IT Linux
2 Barbara Jones 224 IT Mac
3 Jake Rivera 201 R&D DB2
3 Jake Rivera 201 R&D Oracle
3 Jake Rivera 201 R&D Java
• Insert Anomaly - adding null values. eg, inserting a new department does not
require the primary key of emp_no to be added.
• Update Anomaly - multiple updates for a single name change, causes
performance degradation. eg, changing IT dept_name to IS
• Delete Anomaly - deleting wanted information. eg, deleting the IT department
removes employee Barbara Jones from the database
players
player_id game_id name start_date end_date aces blocks spikes digs
45 34 Mike Speedy 1/1/00 12 3 20 5
45 35 Mike Speedy 1/1/00 10 2 15 4
45 40 Mike Speedy 1/1/00 7 2 10 3
78 42 Frank Newmon 5/1/05
102 34 Joe Powers 1/1/02 7/1/05 8 6 18 10
102 35 Joe Powers 1/1/02 7/1/05 10 8 24 12
103 42 Tony Tough 1/1/05 15 10 20 14
games sales
game_id date opponent result sales_id game_id merch tickets
34 6/3/05 Chicago W 120 34 5000 25000
35 6/8/05 Seattle W 122 35 4500 30000
40 6/15/05 Phoenix L 125 40 2500 15000
42 6/20/05 LA W 126 42 6500 40000
players player_stats
player_id game_id aces blocks spikes digs
player_id name start_date end_date
45 34 12 3 20 5
45 Mike Speedy 1/1/00
45 35 10 2 15 4
78 Frank Newmon 5/1/05
45 40 7 2 10 3
102 Joe Powers 1/1/02 7/1/05
102 34 8 6 18 10
103 Tony Tough 1/1/05
102 35 10 8 24 12
103 42 15 10 20 14
1 1
games generates
sales
1
player_stats N
tracked
1
players
Invoice Facts
units sold
unit amount
total sale price
cust_dim_key time_dim_key
name invoice date
address due date
phone delivered date
Location Dimension Product Dimension
loc_dim_key prod_dim_key
store number product
store address price
store phone cost
SAN DIEGO SUPERCOMPUTER CENTER
Star Schema
The fact table forms a one to many relationship with each
dimension table.
Team Facts
date
merchandise
tickets
game_dim_key player_dim_key
opponent name
result start_date
end_date
aces
blocks
spikes
digs
Team Facts
player_dim_key
game_dim_key
date
merchandise
tickets
N N
Player Dimension
1
Game Dimension 1 player_dim_key
name
start_date
game_dim_key end_date
opponent aces
result blocks
spikes
SAN DIEGO SUPERCOMPUTER CENTER digs
Books and Reference
UCSD Extension