europa.csv
world=# create table membership_raw
(State text, GNI text, wage text, UN text, CoE text, OSCE text, EU text, EEA text, CU text, Schengen text, euro text, OECD text, WTO text, ESA text, NATO text, ICC text, VWP text);
world=# \encoding latin1
world=# copy membership_raw from '/home/mh/world/europa.csv' delimiter ';';
world=# select count(code2) from countries where name in (select state from membership_raw);
count
-----
world=# create table countries_x_organisations (code character(3), organisation_id integer);
world=# insert into organisations (id, name) values (nextval('world_seq'), 'Euro');
world=# insert into organisations (id, name) values (nextval('world_seq'), 'EU');
world=# insert into countries_x_organisations (code, organisation_id)
world-# select code, (select id from organisations where name = 'EU') from countries where name in (select state from membership_raw where eu = 'EU');
world=# select c.name, o.name from countries c join countries_x_organisations cxo
on cxo.code = c.code join organisations o on o.id = cxo.organisation_id;