begin;
INSERT INTO tournaments 
  (season, tournamentname, country, location, "date", machine, scoringsystem) VALUES (
    (SELECT season FROM seasons WHERE seasonname='Euromix 2-serie 2002' AND season=( SELECT season FROM seasons WHERE seasonname='Euromix 2-serie 2002' )),
    'Euromix2 serie 10',
    (SELECT country FROM countries WHERE countryname='Norway'),
    'Akers Mic',
    '2002-12-08',
    (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, 'Th0rny' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'Th0rny' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Euromix2 serie 10' AND season=( SELECT season FROM seasons WHERE seasonname='Euromix 2-serie 2002' )),
   1,
   (SELECT player FROM players WHERE nick='Th0rny'),
   22);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'Snute' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'Snute' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Euromix2 serie 10' AND season=( SELECT season FROM seasons WHERE seasonname='Euromix 2-serie 2002' )),
   2,
   (SELECT player FROM players WHERE nick='Snute'),
   19);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'Draconia' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'Draconia' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Euromix2 serie 10' AND season=( SELECT season FROM seasons WHERE seasonname='Euromix 2-serie 2002' )),
   3,
   (SELECT player FROM players WHERE nick='Draconia'),
   17);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'Slusk' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'Slusk' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Euromix2 serie 10' AND season=( SELECT season FROM seasons WHERE seasonname='Euromix 2-serie 2002' )),
   4,
   (SELECT player FROM players WHERE nick='Slusk'),
   15);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'Daniil' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'Daniil' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Euromix2 serie 10' AND season=( SELECT season FROM seasons WHERE seasonname='Euromix 2-serie 2002' )),
   5,
   (SELECT player FROM players WHERE nick='Daniil'),
   13);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'kjmcw' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'kjmcw' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Euromix2 serie 10' AND season=( SELECT season FROM seasons WHERE seasonname='Euromix 2-serie 2002' )),
   6,
   (SELECT player FROM players WHERE nick='kjmcw'),
   11);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'Fiskelim' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'Fiskelim' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Euromix2 serie 10' AND season=( SELECT season FROM seasons WHERE seasonname='Euromix 2-serie 2002' )),
   7,
   (SELECT player FROM players WHERE nick='Fiskelim'),
   9);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'Lejordet' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'Lejordet' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Euromix2 serie 10' AND season=( SELECT season FROM seasons WHERE seasonname='Euromix 2-serie 2002' )),
   8,
   (SELECT player FROM players WHERE nick='Lejordet'),
   8);
commit;
