Вы находитесь на странице: 1из 15

Lecture

4 > Section 1 > ACTIVITY > SOLUTIONS

Lecture 4 Activity Solutions

Lecture 4 > Section 1 > ACTIVITY > SOLUTIONS

Activity 1
Note that various ER diagrams could work, not just the following one!

Lecture 4 > Section 1 > ACTIVITY > SOLUTIONS


Team ID
date

location

Teams
PlayingAway

Note two copies of the


Teams entity here!

Teams play each


other in Games. Each
pair of teams can play
each other multiple
times

PlayingHome

Games

Lecture 4 > Section 1 > ACTIVITY > SOLUTIONS


Team ID
date
name

location

Player ID
Teams
MemberOf

PlayingAway

Players
PlayingHome

Players belong to
Teams (assume no
trades / changes)

Games

Lecture 4 > Section 1 > ACTIVITY > SOLUTIONS


Team ID
date
name

location

Player ID
Teams
MemberOf

PlayingAway

Players
Games

PlayingHome

OccurIn
Plays

Play ID

A Game is made up of
Plays that result in a
yardage gain/loss, and
potentially a touchdown

Yardage Diff

Touchdown

Lecture 4 > Section 1 > ACTIVITY > SOLUTIONS


Team ID
date
name

location

Player ID
Teams
MemberOf

PlayingAway

Players
Games

PlayingHome

Participation Type
OccurIn
Plays

ParticipateIn
Play ID

A Play will contain either a


Pass from one player to
another, or a Run by one
player

Yardage Diff

Touchdown

Lecture 4 > Section 2 > ACTIVITY > SOLUTIONS

Activity 2
Note that various ER diagrams could work, not just the following one!

Lecture 4 > Section 2 > ACTIVITY > SOLUTIONS

Team ID
date
name

location

Player ID
Teams
MemberOf

PlayingAway

Players
Games

PlayingHome

Participation Type
OccurIn
Plays

ParticipateIn

A player can only


belong to one
team, a play can
only be in one
game, a pass/run..?

Play ID

Yardage Diff

Touchdown

Lecture 4 > Section 2 > ACTIVITY > SOLUTIONS

Team ID
date
name

location

Player ID
Teams
MemberOf

PlayingAway

Players
Games

PlayingHome

Participation Type

ParticipateIn

OccurIn
Plays

PRIn

Play ID

Yardage Diff

Touchdown

Players can achieve a


Personal Record
linked to a specific
Game and Play

Lecture 4 > Section 2 > ACTIVITY > SOLUTIONS

Team ID
date
name

location

Player ID
Teams
MemberOf

PlayingAway

Players
WeightOf

Games

PlayingHome

Participation Type
Weight
ParticipateIn

OccurIn

Weight
Player ID

Players might
have different
weights at
different times

Plays
Time Period

PRIn

Play ID

Yardage Diff

Touchdown

Note: point here is that


different players might
have different numbers of
training / weight phases-
hence should represent as
new entity!

Lecture 4 > Section 2 > ACTIVITY > SOLUTIONS

Team ID
date
name

location

Player ID
Teams
MemberOf

PlayingAway

Players
WeightOf

Games

PlayingHome

Participation Type
Weight
ParticipateIn

OccurIn

Weight
Player ID

Plays
Time Period

PRIn

Play ID

Yardage Diff

Touchdown

Players might
have different
weights at
different times

Lecture 4 > Section 3 > ACTIVITY > SOLUTIONS

Extra Activity (Not in Lecture)


Note that various ER diagrams could work, not just the following one!

Lecture 4 > Section 3 > ACTIVITY

Add in: Subclasses, constraints,


and weak entity sets
Concepts to include / model:

Teams belong to
cities- model as
weak entity sets

Players are either


on Offense or
Defense, and are of
types (QB, RB, WR,
TE, K, Farmer*)

All passes are


to exactly one
player; all runs
include a player

Make sure you


have designated
keys for all our
concepts!

13

*https://twitter.com/McBPJ/status/638728908628586496/photo/1

Lecture 4 > Section 3 > ACTIVITY > SOLUTIONS

Team Name

Teams

LocatedIn

Cities

Name

Teams belong to
cities- model as
weak entity sets

Lecture 4 > Section 3 > ACTIVITY > SOLUTIONS

name

Team Name

Player ID

MemberOf

Players

Teams

LocatedIn
PlaysPosition
Type
Position

Cities

String
Name

isa
OffensePosition

OffensivePosType

DefensePosition

DefensivePosType

Players are either


on Offense or
Defense, and are of
types (QB, RB, WR,
TE, K, Farmer*)

Вам также может понравиться