diff --git a/egd.py b/egd.py --- a/egd.py +++ b/egd.py @@ -61,6 +61,11 @@ def setupDB(): cursor.execute("""create table tournaments (code text primary key, datum text, class text, round_count integer, player_count integer, country_code text, description text)""") cursor.execute("""create table players (pin integer primary key, name text)""") cursor.execute("""create table players_performance (pin integer references players(pin), tournament_code text references tournaments(code), country_code text, club text, win_count integer, game_count integer, rating_before real, rating_after real, primary key (pin,tournament_code))""") + cursor.execute(""" + create view players_performance_tournaments (pin,p_country_code,rating_before,rating_after,t_country_code,datum) as + select pin,pp.country_code,rating_before,rating_after,ts.country_code,datum + from players_performance as pp join tournaments as ts on pp.tournament_code=ts.code + """) connection.commit()