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),
"Population" INT,
PRIMARY KEY ("ID"),
FOREIGN KEY ("CountryCode") REFERENCES "country"("Code")
);

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





INSERT INTO "country" VALUES ("USA", "United States of America", "331000000", "78.9");
INSERT INTO "country" VALUES ("CAN", "Canada", "38000000", "82.3");
INSERT INTO "country" VALUES ("MEX", "Mexico", "128000000", "75.0");
INSERT INTO "country" VALUES ("ISL", "Iceland", "360000", "82.9");
INSERT INTO "country" VALUES ("LUX", "Luxembourg", "630000", "82.2");
INSERT INTO "country" VALUES ("MLT", "Malta", "520000", "81.0");
INSERT INTO "country" VALUES ("FJI", "Fiji", "900000", "67.3");
INSERT INTO "country" VALUES ("BRB", "Barbados", "287000", "79.6");
INSERT INTO "country" VALUES ("NRU", "Nauru", "10800", "70.0");
INSERT INTO "country" VALUES ("TUV", "Tuvalu", "11000", "68.5");
INSERT INTO "city" VALUES ("1", "USA", "8800000");
INSERT INTO "city" VALUES ("2", "USA", "4300000");
INSERT INTO "city" VALUES ("3", "CAN", "2700000");
INSERT INTO "city" VALUES ("4", "CAN", "1400000");
INSERT INTO "city" VALUES ("5", "MEX", "9200000");
INSERT INTO "city" VALUES ("6", "MEX", "1600000");
INSERT INTO "city" VALUES ("7", "ISL", "130000");
INSERT INTO "city" VALUES ("8", "LUX", "115000");
INSERT INTO "city" VALUES ("9", "MLT", "140000");
INSERT INTO "city" VALUES ("10", "FJI", "90000");
INSERT INTO "city" VALUES ("11", "BRB", "110000");
INSERT INTO "city" VALUES ("12", "NRU", "10000");
INSERT INTO "city" VALUES ("13", "TUV", "11000");