PRAGMA foreign_keys = ON;

PRAGMA writable_schema = 1;
DELETE FROM sqlite_master WHERE type IN ("table", "index", "trigger");
PRAGMA writable_schema = 0;
VACUUM;

CREATE TABLE "city" (
"ID" INT,
"CountryCode" CHAR(3),
PRIMARY KEY ("ID"),
FOREIGN KEY ("CountryCode") REFERENCES "country"("Code")
);

CREATE TABLE "country" (
"Code" CHAR(3) UNIQUE,
"Name" CHAR(52),
"Population" INT,
"LifeExpectancy" FLOAT,
PRIMARY KEY ("Code")
);

CREATE TABLE "countrylanguage" (
"CountryCode" CHAR(3),
"Language" CHAR(30),
"IsOfficial" TEXT,
PRIMARY KEY ("CountryCode", "Language"),
FOREIGN KEY ("CountryCode") REFERENCES "country"("Code")
);





INSERT INTO "country" VALUES ("USA", "United States", "331000000", "78.9");
INSERT INTO "country" VALUES ("GBR", "United Kingdom", "67000000", "81.2");
INSERT INTO "country" VALUES ("FRA", "France", "67000000", "82.5");
INSERT INTO "country" VALUES ("JPN", "Japan", "126000000", "84.6");
INSERT INTO "country" VALUES ("BRA", "Brazil", "211000000", "75.7");
INSERT INTO "country" VALUES ("DEU", "Germany", "83000000", "81.0");
INSERT INTO "country" VALUES ("RUS", "Russia", "144000000", "72.6");
INSERT INTO "country" VALUES ("CHN", "China", "1402000000", "76.9");
INSERT INTO "country" VALUES ("ESP", "Spain", "47000000", "83.4");
INSERT INTO "country" VALUES ("ITA", "Italy", "60000000", "83.3");
INSERT INTO "countrylanguage" VALUES ("USA", "English", "T");
INSERT INTO "countrylanguage" VALUES ("USA", "Spanish", "F");
INSERT INTO "countrylanguage" VALUES ("GBR", "English", "T");
INSERT INTO "countrylanguage" VALUES ("FRA", "French", "T");
INSERT INTO "countrylanguage" VALUES ("JPN", "Japanese", "T");
INSERT INTO "countrylanguage" VALUES ("BRA", "Portuguese", "T");
INSERT INTO "countrylanguage" VALUES ("DEU", "German", "T");
INSERT INTO "countrylanguage" VALUES ("RUS", "Russian", "T");
INSERT INTO "countrylanguage" VALUES ("CHN", "Chinese", "T");
INSERT INTO "countrylanguage" VALUES ("ESP", "Spanish", "T");
INSERT INTO "countrylanguage" VALUES ("ITA", "Italian", "T");
INSERT INTO "countrylanguage" VALUES ("FRA", "English", "F");
INSERT INTO "countrylanguage" VALUES ("JPN", "English", "F");
INSERT INTO "countrylanguage" VALUES ("BRA", "English", "F");
INSERT INTO "countrylanguage" VALUES ("DEU", "English", "F");
INSERT INTO "countrylanguage" VALUES ("RUS", "English", "F");
INSERT INTO "countrylanguage" VALUES ("CHN", "English", "F");
INSERT INTO "countrylanguage" VALUES ("ESP", "English", "F");
INSERT INTO "countrylanguage" VALUES ("ITA", "English", "F");
INSERT INTO "city" VALUES ("1", "USA");
INSERT INTO "city" VALUES ("2", "GBR");
INSERT INTO "city" VALUES ("3", "FRA");
INSERT INTO "city" VALUES ("4", "JPN");
INSERT INTO "city" VALUES ("5", "BRA");
INSERT INTO "city" VALUES ("6", "DEU");
INSERT INTO "city" VALUES ("7", "RUS");
INSERT INTO "city" VALUES ("8", "CHN");
INSERT INTO "city" VALUES ("9", "ESP");
INSERT INTO "city" VALUES ("10", "ITA");