Upload
trang-le
View
44
Download
11
Embed Size (px)
DESCRIPTION
database
Citation preview
Conceptual Data Modeling A worked example NCAA (Solutions)
(21)18.The NCAA (National Collegiate Athletic Association) wants to develop a database to keep track of information about college basketball. Each university team belongs to only one conference (e.g., the University of Houston belongs to American Athletic Conference; the University of Cincinnati belongs to the BigEast Conference, etc.); but a few teams may not belong to any conference. A conference has several teams; no conference has less than five (5) teams. Each team can have a maximum of twenty (20) players and a minimum of thirteen (13) players. Each player can plays for only one team. Each team has from three (3) to seven (7) coaches on its coaching staff and a coach works for only one team. Lots of games are played in each university location every year; but a game between any two universities is played at a given location only one time a year. Three referees from a larger pool of referees are assigned to each game. A referee can work several games; however, some referees may not be assigned to any game. Players are called players because they play in games; in fact several games. A game involves at least ten players. It is possible that some players simply sit on the bench and do not play in any game. Player performance statistics (i.e., points scored, rebounds, assists, minutes played, and personal fouls committed) are recorded for each player for every game. Information collected about a game includes the final score, the attendance and the date of the game. During the summer months, some of the players serve as counselors in summer youth basketball camps. These camps are identified by their unique campsite location (e.g., Mason, Bellaire, Kenwood, League City, etc.). Each camp has at least three (3) players who serve as counselors,and a player serving as a counselor may work at a number of camps.
A player can be identified by student number(i.e., Social Security number) only. The other attributes for a player include name, major, and grade point average. For a coach, relevant attributes include name, title (e.g., head coach, assistant coach), salary, address, and telephone number. Attributes for a referee include name, salary, years of experience, address,telephone number, and certifications. Both coaches and referees are identified by their personal NCAA identification number. A team is identified by the name of the university(i.e., team). Other team attributes include current ranking, capacity of home court, and number of players. Each conference has a unique name, number of teams, and an annual budget. For the basketball camps, data is available on the campsite (i.e., location) and the number of courts.Develop a Presentation Layer ER model for the NCAA database. The ERD should be fullyspecified with the unique identifiers, other attributes for each entity type, and the relationship types that exist among the various entity types. All business rules that canbe captured in the ERD must be present in the ERD. Any business rule that cannot be captured in the ERDshould be specified as part of a list of semantic integrityconstraints.Hint: No more than seven entity types are needed to complete this design.
Entities & Attributes
1. CONFERENCE: name, #teams and annual budget.2. TEAM(location):University Name, ranking, location, capacity of home court, number of players (derived)3. COACH: NCAA_id_number,name, title (e.g., head coach, assistant coach), salary, address, telephone number.4. GAME: Location, year (partial key), final score, attendance5. REFEREE: NCAA_id ,name, salary, years of experience, address, telephone number, certifications (multi-valued)6. PLAYER: Stu# , name, major GPA.7. CAMP: location, number of courts., Size, Site
Relationships & Structural Constraints Participates: between TEAM (0,1) & CONFERENCE -(5,n) Belongs_to: between TEAM (13,20) & PLAYER(1,1) Coaches:between TEAM (3,7) & COACH (1,1) \ Calls: Between REREREE(0,n) & GAME(3,3) Plays_in:Between PLAYER(0,m) & GAME(10,n) Time played, points scored, rebounds, assists, minutes played, and fouls Counsels: between PLAYER(0,m) & CAMP(3,n) Plays:between GAME(1,1)& TEAM.hosts(1,n) & TEAM.guest (0,m) (Exclusive Arc across Teams to address address team cant play itself)
Presentation Layer ER diagram for the NCAA databaseGame as a weak entity type. The business rules, a game between any two universities is played at a given location only one time a year and a team cannot play itself in any game are captured in the entity-relationship diagram.
22. (19) Add Deletion constraints and develop a design-specific ER diagram for the NCAA database in Exercise 21, by decomposing constructs that cannot directly be mapped to a logical schema: multi-valued attributes and binary relationships of cardinality ratio n:m relationship.
When a referee retires, all links to the games handled by that referee should be removed. Likewise, if a game is cancelled, all links to the referees for that game should be dropped. Although it is does not happen often, a university may sometimes leave the conference of which it is a member. Naturally, we want to keep the team in the database since the university could decide to join another conference at a later date. However, if a team (university) leaves the NCAA altogether, all players and coaches of that team should be removed from the database along with the team. In all other relationships that exist in the database, the default value of Restriction of Deletion should be explicitly indicated
Deletion:1. When a referee retires, all links to the games handled by that referee should be removed.-2. When a game is cancelled, all links to the referees for that game should be dropped3. A university may sometimes leave the conference of which it is a member. Naturally, we want to keep the team in the database since the university could decide to join another conference at a later date.4. However, if a team (university) leaves the NCAA altogether, all players and coaches of that team should be removed from the database along with the team.5. In all other relationships that exist in the database, the default value of Restriction of Deletion should be explicitly indicated.
1. Transform multi-valued attributes REFEREE.Certificaitons to a single-valued attribute
Create Weak Entity Type CERTIFICATION, partial key CertificationIdentification Relationship: Has between REFEREE (1,n)& CERTIFICATION(1,1)
2. Decompose binary m:n relationship type by creating a gerund entity type & required identification dependencies
Plays_in:Between PLAYER(0,n) & GAME(10,n)gerund entity type: EVENTidentification dependency Of between GAME_EVENT (1,1) & GAME(1,N)identification dependency: Participates between GAME_EVENT(1,1) & PLAYER (1,n) Counsels: between PLAYER(0,n) & CAMP(3,n) gerund entity type: COUNCELidentification dependency Serves_as between PLAYER () & ADVISOR (1,1)identification dependency Uses CAMP (1,N) and ADVISOR (1,1)
Calls: Between REREREE(0,n) & GAME(1,n)gerund entity type: REF_CALLidentification dependency Makes between REFEREE (1,N) & CALL (1,1)identification dependency Called_by between GAME (1,N) & CALL (1,1)
Design-Specific ER diagram for the NCAA database
Note: Restrict contraint is the default when no deltion constraint is specified. R conflict with other deletion constraints specified. C are suggested reslolution. Entity name
Value
Entity name
Value
COACH
PLAYER
CAMP
REFEREE
TEAM
Counsels
Calls
plays in
belongs to
coaches
Participates
(1, 1)
(0, m)
(3, 7)
(0, n)
(3, 3)
Phone#
CONFERENCE
(1, n)
(0, 1)
Plays
(0, m)
(13, 20)
Name
GAME
Salary
(1,1)
C
C
N
C
C
Stu#
Major
Name
GPA
Minutes
Fouls
Score
Ranking
Capacity
No._of_players
Title
Year
Location
Loc_yr
Final_score
Attendance
Address
Id_number
(1,1)
R
Location
No.of_courts
Size
Site
Yrs_of_experience
Phone#
Name
Name
#teams
Name
Budget
Salary
R
(3, n)
Address
Certification
Host
Guest
(10,n)
(5,n)
R
R
R
R
Id_number
Rebounds
Assists
(0,m)
Ranking
Entity name
Value
Entity name
Value
PLAYER
COACH
CAMP
REFEREE
TEAM
Participates
belongs to
coaches
Participates
(1, 1)
(3, 7)
Phone#
CONFERENCE
(1, n)
(0, 1)
Plays
(0, m)
(13, 20)
Name
GAME
Salary
(1,1)
(0,n)
C
C
C
N
C
C
Stu#
Major
Name
GPA
Minutes
Fouls
Points
Ranking
Capacity
No._of_players
Title
Year
Location
Loc_yr
Final_score
Attendance
Address
Id_number
Location
No.of_courts
Size
Site
(1,1)
Yrs_of_experience
Phone#
Name
Name
#teams
Name
Budget
Salary
R
Semantic integrity constraint: In order for a player to participate in a game event, that player must belong to a team that is in that game event
(3, n)
Address
Certification
Host
Guest
(10,n)
(5,n)
R
R
R
R
CALL
Makes
Called_by
(1,1)
(1,1)
(3,3)
C
Plays In
Of
(0,m)
(1,1)
(1,1)
Id_number
CERTIFICATION
- - - - - - - - - -
Has
(1,1)
(1,n)
ADVISOR
Uses
Serves_as
(1,1)
(1,1)
(0,n)
Rebounds
Assists
R
C
C
C
C
C
C
R