create table countries ( id serial unique, country_name text not null, country_prefix text, country_shortname text not null ); create table users ( id serial unique, username text not null, password text not null, hostip text ); create table dids ( country_id integer references countries (id), user_id integer references users (id), assigned char constraint assigned in ('Y','N','P'), did text not null );