begin;
INSERT INTO tournaments 
  (season, tournamentname, country, location, "date", machine, scoringsystem) VALUES (
    (SELECT season FROM seasons WHERE seasonname='Geneva Tournament' AND season=( SELECT season FROM seasons WHERE seasonname='Geneva Tournament' )),
    'Geneva Tournament IV (freestyle)',
    (SELECT country FROM countries WHERE countryname='Switzerland'),
    'Las Vegas - Switzerland',
    '2004-06-19',
    (SELECT machine FROM machines WHERE machinename='Dancing Stage EuroMix 2'),
    (SELECT scoringsystem FROM scoringsystems WHERE scoringsystemname='10K Machine score')
);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'Boli' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'Boli' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Geneva Tournament IV (freestyle)' AND season=( SELECT season FROM seasons WHERE seasonname='Geneva Tournament' )),
   1,
   (SELECT player FROM players WHERE nick='Boli'),
   NULL);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'Kyo X' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'Kyo X' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Geneva Tournament IV (freestyle)' AND season=( SELECT season FROM seasons WHERE seasonname='Geneva Tournament' )),
   2,
   (SELECT player FROM players WHERE nick='Kyo X'),
   NULL);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'Dex' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'Dex' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Geneva Tournament IV (freestyle)' AND season=( SELECT season FROM seasons WHERE seasonname='Geneva Tournament' )),
   3,
   (SELECT player FROM players WHERE nick='Dex'),
   NULL);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'Red Baron' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'Red Baron' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Geneva Tournament IV (freestyle)' AND season=( SELECT season FROM seasons WHERE seasonname='Geneva Tournament' )),
   3,
   (SELECT player FROM players WHERE nick='Red Baron'),
   NULL);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'T Master' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'T Master' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Geneva Tournament IV (freestyle)' AND season=( SELECT season FROM seasons WHERE seasonname='Geneva Tournament' )),
   5,
   (SELECT player FROM players WHERE nick='T Master'),
   NULL);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'Loopy Chew' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'Loopy Chew' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Geneva Tournament IV (freestyle)' AND season=( SELECT season FROM seasons WHERE seasonname='Geneva Tournament' )),
   6,
   (SELECT player FROM players WHERE nick='Loopy Chew'),
   NULL);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'Hirro' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'Hirro' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Geneva Tournament IV (freestyle)' AND season=( SELECT season FROM seasons WHERE seasonname='Geneva Tournament' )),
   7,
   (SELECT player FROM players WHERE nick='Hirro'),
   NULL);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'Ganon' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'Ganon' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Geneva Tournament IV (freestyle)' AND season=( SELECT season FROM seasons WHERE seasonname='Geneva Tournament' )),
   8,
   (SELECT player FROM players WHERE nick='Ganon'),
   NULL);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'Lord Glenn' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'Lord Glenn' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Geneva Tournament IV (freestyle)' AND season=( SELECT season FROM seasons WHERE seasonname='Geneva Tournament' )),
   9,
   (SELECT player FROM players WHERE nick='Lord Glenn'),
   NULL);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'F Destroyer' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'F Destroyer' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Geneva Tournament IV (freestyle)' AND season=( SELECT season FROM seasons WHERE seasonname='Geneva Tournament' )),
   9,
   (SELECT player FROM players WHERE nick='F Destroyer'),
   NULL);
commit;
