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' )),
    'Olso Pro-turnering',
    (SELECT country FROM countries WHERE countryname='Norway'),
    'Oslo Bowling',
    '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, 'Tom' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'Tom' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Olso Pro-turnering' AND season=( SELECT season FROM seasons WHERE seasonname='Testturnering' )),
   1,
   (SELECT player FROM players WHERE nick='Tom'),
   NULL);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'Magnar' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'Magnar' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Olso Pro-turnering' AND season=( SELECT season FROM seasons WHERE seasonname='Testturnering' )),
   2,
   (SELECT player FROM players WHERE nick='Magnar'),
   NULL);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'DufF' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'DufF' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Olso Pro-turnering' AND season=( SELECT season FROM seasons WHERE seasonname='Testturnering' )),
   3,
   (SELECT player FROM players WHERE nick='DufF'),
   NULL);
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='Olso Pro-turnering' AND season=( SELECT season FROM seasons WHERE seasonname='Testturnering' )),
   4,
   (SELECT player FROM players WHERE nick='Draconia'),
   NULL);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'Telc' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'Telc' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Olso Pro-turnering' AND season=( SELECT season FROM seasons WHERE seasonname='Testturnering' )),
   5,
   (SELECT player FROM players WHERE nick='Telc'),
   NULL);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'Havok' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'Havok' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Olso Pro-turnering' AND season=( SELECT season FROM seasons WHERE seasonname='Testturnering' )),
   6,
   (SELECT player FROM players WHERE nick='Havok'),
   NULL);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'Lykkesopp' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'Lykkesopp' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Olso Pro-turnering' AND season=( SELECT season FROM seasons WHERE seasonname='Testturnering' )),
   7,
   (SELECT player FROM players WHERE nick='Lykkesopp'),
   NULL);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'Yeye' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'Yeye' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Olso Pro-turnering' AND season=( SELECT season FROM seasons WHERE seasonname='Testturnering' )),
   8,
   (SELECT player FROM players WHERE nick='Yeye'),
   NULL);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'Vampyro' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'Vampyro' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Olso Pro-turnering' AND season=( SELECT season FROM seasons WHERE seasonname='Testturnering' )),
   9,
   (SELECT player FROM players WHERE nick='Vampyro'),
   NULL);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'Zealot' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'Zealot' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Olso Pro-turnering' AND season=( SELECT season FROM seasons WHERE seasonname='Testturnering' )),
   10,
   (SELECT player FROM players WHERE nick='Zealot'),
   NULL);
INSERT INTO players SELECT nextval('players_player_seq') AS player, 'Mulefisk' AS nick, ( SELECT country FROM countries WHERE countryname='Norway' ) AS country WHERE 'Mulefisk' NOT IN ( SELECT nick FROM players );
INSERT INTO tournamentrankings (tournament, ranking, player, points) VALUES (
   (SELECT tournament FROM tournaments WHERE tournamentname='Olso Pro-turnering' AND season=( SELECT season FROM seasons WHERE seasonname='Testturnering' )),
   11,
   (SELECT player FROM players WHERE nick='Mulefisk'),
   NULL);
commit;
