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 "country" (
"Code" CHAR(3) UNIQUE,
"Name" CHAR(52),
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");
INSERT INTO "country" VALUES ("MEX", "Mexico");
INSERT INTO "country" VALUES ("ARG", "Argentina");
INSERT INTO "country" VALUES ("COL", "Colombia");
INSERT INTO "country" VALUES ("PER", "Peru");
INSERT INTO "country" VALUES ("CHL", "Chile");
INSERT INTO "country" VALUES ("USA", "United States");
INSERT INTO "country" VALUES ("CAN", "Canada");
INSERT INTO "country" VALUES ("BRA", "Brazil");
INSERT INTO "country" VALUES ("FRA", "France");
INSERT INTO "countrylanguage" VALUES ("ESP", "Spanish", "95.0");
INSERT INTO "countrylanguage" VALUES ("ESP", "Catalan", "4.0");
INSERT INTO "countrylanguage" VALUES ("MEX", "Spanish", "98.5");
INSERT INTO "countrylanguage" VALUES ("MEX", "Nahuatl", "1.0");
INSERT INTO "countrylanguage" VALUES ("ARG", "Spanish", "99.0");
INSERT INTO "countrylanguage" VALUES ("COL", "Spanish", "99.2");
INSERT INTO "countrylanguage" VALUES ("PER", "Spanish", "84.1");
INSERT INTO "countrylanguage" VALUES ("PER", "Quechua", "13.0");
INSERT INTO "countrylanguage" VALUES ("CHL", "Spanish", "99.5");
INSERT INTO "countrylanguage" VALUES ("USA", "English", "82.1");
INSERT INTO "countrylanguage" VALUES ("USA", "Spanish", "13.4");
INSERT INTO "countrylanguage" VALUES ("CAN", "English", "58.7");
INSERT INTO "countrylanguage" VALUES ("CAN", "French", "22.0");
INSERT INTO "countrylanguage" VALUES ("BRA", "Portuguese", "97.5");
INSERT INTO "countrylanguage" VALUES ("FRA", "French", "93.0");
INSERT INTO "countrylanguage" VALUES ("FRA", "German", "1.0");