#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    9
    Rep Power
    0

    Struck with EER Diagram for soccer league...


    I have asked to draw an EER diagram for an assingmnet. i drew all the entities and relationships but at last there is a problem to draw away and home matches.
    Each team plays every other team twice (once at home and once away). how to draw this on ER.. I dont understand the logic..

    and the other thing is

    Teams are also described by the city in which they are located and the division and league in which they play (such as premier division or first division). can we use team as superclass and 1st and premier as subclass..

    Thankz in Advance..
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,149
    Rep Power
    4274
    Originally Posted by ishan2ma
    Each team plays every other team twice (once at home and once away). how to draw this on ER..
    you need a "fixture" entity (for each game played), and many-to-one relationship between teams and fixtures


    Originally Posted by ishan2ma
    Teams are also described by the city in which they are located and the division and league in which they play (such as premier division or first division). can we use team as superclass and 1st and premier as subclass..
    no, divisions are a separate entity, with a one-to-many relationship between divisions and teams
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    9
    Rep Power
    0

    Thank you for the reply


    can i do like this as
    team--away---results
    team--home--results
    then
    matches--has--result

    away and home attributes are (match_ID, no_of_goals,Team_ID)

    team(Home_team_ID, Away_team_ID, Venue, Match_ID)

    Result(match_ID, result_ID, Winner)

    will this be ok when mapping and retrieving will i get problems.
  6. #4
  7. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,149
    Rep Power
    4274
    several problems

    first, a team in the teams table should not have different ids for home and away

    second, if you put match_id into the teams table, then each team can play only one match

    finally, results table is superfluous, put the winner into the matches table
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

IMN logo majestic logo threadwatch logo seochat tools logo