High Level Database Models
Thomas Schwarz, SJ
High Level Database Models Thomas Schwarz, SJ Contents Design - - PowerPoint PPT Presentation
High Level Database Models Thomas Schwarz, SJ Contents Design Phase Implementation High Relational Relational Ideas Level Database Database Design Scheme Scheme Design Language: Entity Relationship Model (ERM) Unified
Thomas Schwarz, SJ
Ideas High Level Design Relational Database Scheme Relational Database Scheme Design Phase Implementation
Stars- in
Stars Studios Movies title year length genre
Owns
name address address name
uniqueness
runs
Studio President
studio)
Contracts Stars Movies Studio
for a movie, there can only be one studio
movie
Contracts Stars Movies Studio
Contracts Stars Movies Studio
Sequel of Movies
sequel
with multiple roles
lent them out to another studio
Contracts Stars Movies Studio
Studio of Star Producing Studio
the relationship
Contracts Stars Movies Studio name address address name title year length genre salary
Contracts Stars Movies Studio name address address name title year length genre salary Salary
can be modeled through an entity as well
Star-of Movie-of Stars Movies Contract Studios Studio-of- star Producing Studio
isa
Cartoons Movies Murder Mystery
isa
Voices Stars name address title length year genre weapon
courses many to many or one to many?
studios and add an attribute “studio” to movies.
holdings can also be done away with
longer computations
Repre‐ sents Movies Holdings Studios Owns
using
not need the stars-in relationship
attributes to a movie
movies
update anomaly
key
primary key
Stars- in
Stars Studios Movies title year length genre
Owns
name address address name
President Studios Movies title year length genre
Ownsname address address name
entity:
Runs
President Studios Movies title year length genre
Owns
name address address name
entity:
the president table
Runs
President Studios Movies title year length genre
Owns
name address address name
entity:
persists
Runs
President Studios Movies title year length genre
Owns
name address address name
entity:
Runs
President Studios Movies title year length genre
Owns
name address address name
an entity set
Stars- in
Stars Movies title year length genre name address
<=10
(all or some) to another entity
Studios Crews number chief
Unit of
address name
Genus Species name
belongs to
name
relationships
studio.name, movies.title, movies.year
Stars Movies Studio name address address name title year length genre salary Contracts
Star of Studio
Movie
certain many-to relationships
supporting entity sets, resp.
conditions are true
are also keys for F
E F
R
might be supplied by an entity G, etc.
E F
R
G
S
attributes of F to help form the key of E
with different entities and so the parts of the key
e ∈ E f1, f2 ∈ F E
E F
R S
supporting relationship
this data.
Studios Crews number chief
Unit of
address name
by following the relationship “Unit of”
Studios Crews number chief
Unit of
address name
diagram
enrollment as a connecting entity
Students address name id number course course number Depart ment Term Timeslot Instructor Enrollment grade
enrolled in enrolled in
and exactly a course
Students address name id number course course number Depart ment Term Timeslot Instructor Enrollment grade
enrolled in enrolled in
same number
Department address name course course number
teaches
attributes
the keys for the connected entity set
connected by a many-to-one relationship
Stars- in
Stars Studios Movies title year length genre
Owns
name address address name
stars(name, address) movies(title, year, length, genre)
Stars- in
Stars Studios Movies title year length genre
Owns
name address address name
studios(name, address) starsIn(name, title, year)
Contracts Stars Movies Studio
Studio of Star Producing Studio
Contracts Stars Movies Studio
Studio of Star Producing Studio
stars(name, address) movies(title, year, length, genre) studios(name, address) contracts(name, title, year, studioOfStar, producingStudio)
attributes of supporting entity sets
set must use as a key all of its key attributes, including those in supporting entities
represented in an entity itself
force it to have these relationships
Studios address name Crews number chief
Unit of
Studios address name Crews number chief
Unit of
Studios address name Crews number chief
Unit of
Studios address name Crews number chief
Unit of
hierarchy
the entity sets of any subtree of the hierarchy that includes root
isa
Cartoons Movies Murder Mystery
isa
Voices Stars name address title length year genre weapon
isa
Cartoons Movies Murder Mystery
isa
Voices Stars name address title length year genre weapon
have silent cartoons
isa
Cartoons Movies Murder Mystery
isa
Voices Stars name address title length year genre weapon
the hierarchy
weapon)
relations
relations
minutes?”
moviesCMM
whether the movie is a cartoon, then access murderMysteries to find out the weapon
very long
Person name address
ChildOf FatherOf MotherOf Married
isa
Child Father Mother
isa isa
UML E/R class entity set association binary relationship association class attributes on a relationship subclass Is-a hierarchy aggregation many-one relationship composition many-one relationship with rreferential integrity
<place for methods> title PK year PK length genre Movies
<place for methods> title PK year PK length genre Movies
name PK address studios title PK year PK length genre movies name PK address stars
stars-in 0..1 0..* 0..* 0..*
associations at the other end
movies
name PK address studios title PK year PK length genre movies name PK address stars
stars-in 0..1 0..* 0..* 0..*
name PK address studios title PK year PK length genre movies
cert# PK name address President
runs 1..* 1..1 1..1 0..1
sequel) or one movie (it is a sequel
title PK year PK length genre movies
0..1 TheOriginal TheSequel 0..*
by the objects that are associated
title PK year PK length genre movies name PK address stars
stars-in 0..* 0..*
salary residuals compensation
title PK year PK length genre movies weapon MurderMysteries Cartoons weapon Cartoon MurderMysteries
association
more than one
title PK year PK length genre movies name PK address studios
1..*
presidents cert# PK name address networth MovieExecs
0..1
attributes
number PK crew Chief crews name PK address studios
0..* 1..1 PK
attributes of the two connected classes
attributes of the association class
length, genre)
movieTitle, movieYear)
movieTitle, movieYear)
name PK address studios title PK year PK length genre movies name PK address stars
stars-in 0..1 0..* 0..* 0..*
title PK year PK length genre movies name PK address stars
stars-in 0..* 0..*
salary residuals compensation
title PK year PK length genre movies name PK address studios
1..*
presidents cert# PK name address networth MovieExecs
0..1
Use E/R approach
title PK year PK length genre movies name PK address studios
1..*
presidents cert# PK name address networth MovieExecs
0..1
movies(title, year, length, genre) studios(name, address) movieExecs(cert#, name, address networth) presidents(cert#) presides(cert#, studioName)
title PK year PK length genre movies name PK address studios
1..*
presidents cert# PK name address networth MovieExecs
0..1
movies(title, year, length, genre) studios(name, address) movieExecs(cert#, name, address networth) presidents(cert#) presides(cert#, studioName)
attributes
title PK year PK length genre movies name PK address studios
1..*
presidents cert# PK name address networth MovieExecs
0..1
movies(title, year, length, genre, studioName) studios(name, address) movieExecs(cert#, name, address, netWorth) presides(cert#, studioName)