begin;
INSERT INTO tournaments 
  (season, tournamentname, country, location, "date", machine, scoringsystem) VALUES (
    (SELECT season FROM seasons WHERE seasonname='Testturnering' AND season=( SELECT season FROM seasons WHERE seasonname='Testturnering' )),
    'Follo Pro-turnering',
    (SELECT country FROM countries WHERE countryname='Norway'),
    'Lille Paris',
    '2003-05-11',
    (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, '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='Follo Pro-turnering' AND season=( SELECT season FROM seasons WHERE seasonname='Testturnering' )),
   1,
   (SELECT player FROM players WHERE nick='Snute'),
   NULL);
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='Follo Pro-turnering' AND season=( SELECT season FROM seasons WHERE seasonname='Testturnering' )),
   2,
   (SELECT player FROM players WHERE nick='Th0rny'),
   NULL);
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='Follo Pro-turnering' AND season=( SELECT season FROM seasons WHERE seasonname='Testturnering' )),
   3,
   (SELECT player FROM players WHERE nick='Slusk'),
   NULL);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'RiChY' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'RiChY' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Follo Pro-turnering' AND season=( SELECT season FROM seasons WHERE seasonname='Testturnering' )),
   4,
   (SELECT player FROM players WHERE nick='RiChY'),
   NULL);
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='Follo Pro-turnering' AND season=( SELECT season FROM seasons WHERE seasonname='Testturnering' )),
   5,
   (SELECT player FROM players WHERE nick='Fiskelim'),
   NULL);
commit;
