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,
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 ("ABW", "Aruba", "110000");
INSERT INTO "country" VALUES ("USA", "United States", "331000000");
INSERT INTO "country" VALUES ("CAN", "Canada", "38000000");
INSERT INTO "country" VALUES ("MEX", "Mexico", "128000000");
INSERT INTO "country" VALUES ("BRA", "Brazil", "212000000");
INSERT INTO "city" VALUES ("1", "ABW");
INSERT INTO "city" VALUES ("2", "USA");
INSERT INTO "city" VALUES ("3", "CAN");
INSERT INTO "city" VALUES ("4", "MEX");
INSERT INTO "city" VALUES ("5", "BRA");
INSERT INTO "countrylanguage" VALUES ("ABW", "Dutch", "30.0");
INSERT INTO "countrylanguage" VALUES ("ABW", "Papiamento", "60.0");
INSERT INTO "countrylanguage" VALUES ("ABW", "English", "10.0");
INSERT INTO "countrylanguage" VALUES ("USA", "English", "80.0");
INSERT INTO "countrylanguage" VALUES ("USA", "Spanish", "13.0");
INSERT INTO "countrylanguage" VALUES ("CAN", "English", "60.0");
INSERT INTO "countrylanguage" VALUES ("CAN", "French", "23.0");
INSERT INTO "countrylanguage" VALUES ("MEX", "Spanish", "95.0");
INSERT INTO "countrylanguage" VALUES ("MEX", "Nahuatl", "1.5");
INSERT INTO "countrylanguage" VALUES ("BRA", "Portuguese", "98.0");
INSERT INTO "countrylanguage" VALUES ("BRA", "Spanish", "1.0");