CREATE TABLE country(
id VARCHAR(50) NOT NULL PRIMARY KEY,
name VARCHAR(50),
car_code VARCHAR(50),
capital VARCHAR(50),
continent VARCHAR(50),
datacode VARCHAR(50),
area VARCHAR(50),
total_area VARCHAR(5),
population VARCHAR(50),
population_growth VARCHAR(50),
infant_mortality VARCHAR(50),
gdp_agri VARCHAR(50),
gdp_ind VARCHAR(50),
gdp_serv VARCHAR(50),
gdp_total VARCHAR(50),
infaltion VARCHAR(50),
indep_date VARCHAR(50),
government VARCHAR(50),
FOREIGN KEY (capital) REFERENCES city (id),
FOREIGN KEY (continent) REFERENCES continent (id)
);

CREATE TABLE encompass(
name VARCHAR(50),
percentage VARCHAR(50),
country VARCHAR(50),
continent VARCHAR(50),
PRIMARY KEY (name),
FOREIGN KEY (country) REFERENCES country (id),
FOREIGN KEY (continent) REFERNCES continent (id)
);

CREATE TABLE province(
id VARCHAR(50) NOT NULL PRIMARY KEY,
name VARCHAR(50),
country VARCHAR(50),
capital VARCHAR(50),
population VARCHAR(50),
area VARCHAR(50),
FOREIGN KEY (country) REFERENCES country (id),
FOREIGN KEY (capital) REFERENCES city (id),
FOREIGN KEY (population) REFERENCES population (id)
);

CREATE TABLE ethnigroup(
name VARCHAR(50) NOT NULL PRIMARY KEY,
percentage VARCHAR(50),
country VARCHAR(50),
FOREIGN KEY (country) REFERENCES country (id)
);

CREATE TABLE religion(
name VARCHAR(50) NOT NULL PRIMARY KEY,
percentage VARCHAR(50),
country VARCHAR(50),
FOREIGN KEY (country) REFERENCES country (id)
);

CREATE TABLE language(
name VARCHAR(50) NOT NULL PRIMARY KEY,
percentage VARCHAR(50),
country VARCHAR(50),
FOREIGN KEY (country) REFERENCES country (id)
);

CREATE TABLE border(
name VARCHAR(50) NOT NULL PRIMARY KEY,
length VARCHAR(50), 
justice VARCHAR(50),
forCountry VARCHAR(50),
borderingCountry VARCHAR(50),
FOREIGN KEY (forCountry) REFERENCES country (id),
FOREIGN KEY (borderingCountry) REFERENCES country (id)
);

CREATE TABLE city(
id VARCHAR(50) NOT NULL PRIMARY KEY,
name VARCHAR(50),
is_countryCap VARCHAR(20),
is_stateCap VARCHAR(20),
longitude VARCHAR(50),
latitude VARCHAR(50),
country VARCHAR(50),
province VARCHAR(50),
FOREIGN KEY (country) REFERENCES country (id),
FOREIGN KEY (province) REFERENCES province (id)
);

CREATE TABLE cityPopu(
city VARCHAR(50),
population VARCHAR(50),
PRIMARY KEY (city, population),
FOREIGN KEY (city) REFERENCES city (id),
FOREIGN KEY (population) REFERENCES population (id)
);

CREATE TABLE population(
id VARCHAR(50) NOT NULL PRIMARY KEY,
year VARCHAR(50),
number VARCHAR(50)
);

CREATE TABLE continent(
id VARCHAR(50) NOT NULL PRIMARY KEY,
name VARCHAR(50),
area VARCHAR(50)
);

CREATE TABLE organization(
id VARCHAR(50) NOT NULL PRIMARY KEY,
name VARCHAR(50),
abbrev VARCHAR(50),
seat VARCHAR(50)
);

CREATE TABLE mountain(
id VARCHAR(50) NOT NULL PRIMARY KEY,
name VARCHAR(50),
height VARCHAR(50),
longitude VARCHAR(50),
latitude VARCHAR(50)
);

CREATE TABLE sea(
id VARCHAR(50) NOT NULL PRIMARY KEY,
name VARCHAR(50),
depth VARCHAR(50),
bordering VARCHAR(50)
);

CREATE TABLE river(
id VARCHAR(50) NOT NULL PRIMARY KEY,
name VARCHAR(50),
length VARCHAR(50)
);

CREATE TABLE lake(
id VARCHAR(50) NOT NULL PRIMARY KEY,
name VARCHAR(50),
area VARCHAR(50)
);

CREATE TABLE desert(
id VARCHAR(50) NOT NULL PRIMARY KEY,
name VARCHAR(50),
area VARCHAR(50)
);

CREATE TABLE island(
id VARCHAR(50) NOT NULL PRIMARY KEY,
name VARCHAR(50),
area VARCHAR(50),
longitude VARCHAR(50),
latitude VARCHAR(50)
);

CREATE TABLE city_located(
id VARCHAR(50) NOT NULL PRIMARY KEY,
waterType VARCHAR(50),
city VARCHAR(50),
sea VARCHAR(50),
lake VARCHAR(50),
river VARCHAR(50),
FOREIGN KEY (city) REFERENCES city (id),
FOREIGN KEY (lake) REFERENCES lake (id),
FOREIGN KEY (sea) REFERENCES sea (id),
FOREIGN KEY (river) REFERENCES river (id)
);

CREATE TABLE mountain_located(
id VARCHAR(50) NOT NULL PRIMARY KEY,
mountain VARCHAR(50),
country VARCHAR(50),
province VARCHAR(50),
FOREIGN KEY (mountain) REFERENCES mountain (id),
FOREIGN KEY (country) REFERENCES country (id),
FOREIGN KEY (province) REFERENCES province (id)
);


CREATE TABLE sea_located(
id VARCHAR(50) NOT NULL PRIMARY KEY,
sea VARCHAR(50),
country VARCHAR(50),
province VARCHAR(50),
FOREIGN KEY (sea) REFERENCES sea (id),
FOREIGN KEY (country) REFERENCES country (id),
FOREIGN KEY (province) REFERENCES province (id)
);

CREATE TABLE lake_located(
id VARCHAR(50) NOT NULL PRIMARY KEY,
lake VARCHAR(50),
country VARCHAR(50),
province VARCHAR(50),
FOREIGN KEY (lake) REFERENCES lake (id),
FOREIGN KEY (country) REFERENCES country (id),
FOREIGN KEY (province) REFERENCES province (id)
);

CREATE TABLE river_located(
id VARCHAR(50) NOT NULL PRIMARY KEY,
river VARCHAR(50),
country VARCHAR(50),
province VARCHAR(50),
FOREIGN KEY (river) REFERENCES river (id),
FOREIGN KEY (country) REFERENCES country (id),
FOREIGN KEY (province) REFERENCES province (id)
);

CREATE TABLE desert_located(
id VARCHAR(50) NOT NULL PRIMARY KEY,
desert VARCHAR(50),
country VARCHAR(50),
province VARCHAR(50),
FOREIGN KEY (desert) REFERENCES desert (id),
FOREIGN KEY (country) REFERENCES country (id),
FOREIGN KEY (province) REFERENCES province (id)
);

CREATE TABLE island_located(
id VARCHAR(50) NOT NULL PRIMARY KEY,
island VARCHAR(50),
country VARCHAR(50),
province VARCHAR(50),
FOREIGN KEY (island) REFERENCES island (id),
FOREIGN KEY (country) REFERENCES country (id),
FOREIGN KEY (province) REFERENCES province (id)
);

CREATE TABLE member(
id VARCHAR(50) NOT NULL PRIMARY KEY,
org VARCHAR(50),
country VARCHAR(50),
type VARCHAR(50),
FOREIGN KEY (org) REFERENCES organization (id),
FOREIGN KEY (country) REFERENCES country (id)
);
