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),
"Region" CHAR(26),
PRIMARY KEY ("Code")
);

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





INSERT INTO "country" VALUES ("ESP", "Spain", "Europe");
INSERT INTO "country" VALUES ("MEX", "Mexico", "North America");
INSERT INTO "country" VALUES ("ARG", "Argentina", "South America");
INSERT INTO "country" VALUES ("USA", "United States", "North America");
INSERT INTO "country" VALUES ("FRA", "France", "Europe");
INSERT INTO "country" VALUES ("BRA", "Brazil", "South America");
INSERT INTO "country" VALUES ("CHL", "Chile", "South America");
INSERT INTO "country" VALUES ("CAN", "Canada", "North America");
INSERT INTO "country" VALUES ("COL", "Colombia", "South America");
INSERT INTO "country" VALUES ("DEU", "Germany", "Europe");
INSERT INTO "countrylanguage" VALUES ("ESP", "Spanish", "98.0");
INSERT INTO "countrylanguage" VALUES ("MEX", "Spanish", "92.7");
INSERT INTO "countrylanguage" VALUES ("ARG", "Spanish", "97.2");
INSERT INTO "countrylanguage" VALUES ("USA", "English", "82.1");
INSERT INTO "countrylanguage" VALUES ("USA", "Spanish", "13.5");
INSERT INTO "countrylanguage" VALUES ("FRA", "French", "88.0");
INSERT INTO "countrylanguage" VALUES ("BRA", "Portuguese", "99.0");
INSERT INTO "countrylanguage" VALUES ("CHL", "Spanish", "99.0");
INSERT INTO "countrylanguage" VALUES ("CAN", "English", "56.0");
INSERT INTO "countrylanguage" VALUES ("CAN", "French", "22.0");
INSERT INTO "countrylanguage" VALUES ("COL", "Spanish", "99.5");
INSERT INTO "countrylanguage" VALUES ("DEU", "German", "95.0");
INSERT INTO "city" VALUES ("1", "ESP");
INSERT INTO "city" VALUES ("2", "MEX");
INSERT INTO "city" VALUES ("3", "ARG");
INSERT INTO "city" VALUES ("4", "USA");
INSERT INTO "city" VALUES ("5", "FRA");
INSERT INTO "city" VALUES ("6", "BRA");
INSERT INTO "city" VALUES ("7", "CHL");
INSERT INTO "city" VALUES ("8", "CAN");
INSERT INTO "city" VALUES ("9", "COL");
INSERT INTO "city" VALUES ("10", "DEU");