Main Diagram

U Read column and table comments by hovering the columns and tables. Zoom with CTRL+whell mouse button, pan by dragging the diagram with the right-mouse button DbSchema Database Designer Main Diagram Read schema comments as mouse-over tooltips DbSchema.com © 2026-06-13 Wise CodersDbSchema.com © 2026-06-13 Wise Coders teams 🔗 Foreign Key fk_matches_home_team matches ➔ teams ( home_team_id -> id ) 🔗 Foreign Key fk_matches_home_team matches ➔ teams ( home_team_id -> id ) home_team_id 🔗 Foreign Key fk_matches_away_team matches ➔ teams ( away_team_id -> id ) 🔗 Foreign Key fk_matches_away_team matches ➔ teams ( away_team_id -> id ) away_team_id 🔗 Foreign Key fk_players_team players ➔ teams ( team_id -> id ) 🔗 Foreign Key fk_players_team players ➔ teams ( team_id -> id ) team_id Table public.matchesmatches 🔑 Pk pk_matches ( id ) ⧉ id * integerid # ⧉ home_team_id * integer ↗ teams( id )home_team_id 🔗 References teams ( home_team_id -> id ) ⧉ away_team_id * integer ↗ teams( id )away_team_id 🔗 References teams ( away_team_id -> id ) ⧉ match_date datematch_date d ⧉ home_score integerhome_score # ⧉ away_score integeraway_score # Table public.players ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Team playersplayers 🔑 Pk pk_players ( id ) ⧉ id * integerid # ⧉ team_id * integer ↗ teams( id )team_id 🔗 References teams ( team_id -> id ) ⧉ name * varchar(100)name t ⧉ position varchar(50) ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Player role on the field, e.g. goalkeeper, defenderposition t ⧉ jersey_number integerjersey_number # Table public.teams ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Sports teams participating in the leagueteams 🔑 Pk pk_teams ( id ) ⧉ id * integer ↙ matches( home_team_id ) ↙ matches( away_team_id ) ↙ players( team_id )id 🔗 Referred by matches ( home_team_id -> id ) Referred by matches ( away_team_id -> id ) Referred by players ( team_id -> id ) ⧉ name * varchar(100)name t ⧉ city varchar(100) ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Home citycity t ⧉ founded_year integerfounded_year #


Schema postgres.public

standard public schema



Table matches
IdxColumn NameData Type
* id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY
* home_team_id integer NOT NULL
* away_team_id integer NOT NULL
  match_date date
  home_score integer
  away_score integer
Indexes
pk_matches Primary Key ON id
Foreign Key
fk_matches_home_team home_team_id ↗ ❏ teams(id)
fk_matches_away_team away_team_id ↗ ❏ teams(id)


Table players

Team players

IdxColumn NameDefinitionDescription
* id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY
* team_id integer NOT NULL
* name varchar(100) NOT NULL
  position varchar(50) Player role on the field, e.g. goalkeeper, defender
  jersey_number integer
Indexes
pk_players Primary Key ON id
Foreign Key
fk_players_team team_id ↗ ❏ teams(id)


Table teams

Sports teams participating in the league

IdxColumn NameDefinitionDescription
* id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY
* name varchar(100) NOT NULL
  city varchar(100) Home city
  founded_year integer
Indexes
pk_teams Primary Key ON id
Referring Foreign Key
fk_matches_home_team id ↙ ❏ matches(home_team_id)
fk_matches_away_team id ↙ ❏ matches(away_team_id)
fk_players_team id ↙ ❏ players(team_id)