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,
"Name" CHAR(35),
"CountryCode" CHAR(3),
"Population" INT,
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 ("USA", "United States of America", "331000000");
INSERT INTO "country" VALUES ("GBR", "United Kingdom", "67000000");
INSERT INTO "country" VALUES ("CAN", "Canada", "38000000");
INSERT INTO "country" VALUES ("AUS", "Australia", "25000000");
INSERT INTO "country" VALUES ("IND", "India", "1380000000");
INSERT INTO "country" VALUES ("NGA", "Nigeria", "206000000");
INSERT INTO "country" VALUES ("FRA", "France", "67000000");
INSERT INTO "country" VALUES ("ESP", "Spain", "47000000");
INSERT INTO "countrylanguage" VALUES ("USA", "English", "95.0");
INSERT INTO "countrylanguage" VALUES ("GBR", "English", "98.0");
INSERT INTO "countrylanguage" VALUES ("CAN", "English", "60.0");
INSERT INTO "countrylanguage" VALUES ("CAN", "French", "23.0");
INSERT INTO "countrylanguage" VALUES ("AUS", "English", "97.0");
INSERT INTO "countrylanguage" VALUES ("IND", "Hindi", "40.0");
INSERT INTO "countrylanguage" VALUES ("IND", "English", "12.0");
INSERT INTO "countrylanguage" VALUES ("NGA", "English", "53.0");
INSERT INTO "countrylanguage" VALUES ("FRA", "French", "88.0");
INSERT INTO "countrylanguage" VALUES ("ESP", "Spanish", "92.0");
INSERT INTO "city" VALUES ("1", "New York", "USA", "8400000");
INSERT INTO "city" VALUES ("2", "Los Angeles", "USA", "4000000");
INSERT INTO "city" VALUES ("3", "London", "GBR", "8900000");
INSERT INTO "city" VALUES ("4", "Manchester", "GBR", "550000");
INSERT INTO "city" VALUES ("5", "Toronto", "CAN", "2800000");
INSERT INTO "city" VALUES ("6", "Vancouver", "CAN", "630000");
INSERT INTO "city" VALUES ("7", "Sydney", "AUS", "5300000");
INSERT INTO "city" VALUES ("8", "Melbourne", "AUS", "5000000");
INSERT INTO "city" VALUES ("9", "Mumbai", "IND", "12400000");
INSERT INTO "city" VALUES ("10", "Lagos", "NGA", "14000000");
INSERT INTO "city" VALUES ("11", "Paris", "FRA", "2140000");
INSERT INTO "city" VALUES ("12", "Madrid", "ESP", "3200000");
INSERT INTO "city" VALUES ("13", "Calgary", "CAN", "1239000");
INSERT INTO "city" VALUES ("14", "Birmingham", "GBR", "1140000");
INSERT INTO "city" VALUES ("15", "Brisbane", "AUS", "2300000");
INSERT INTO "city" VALUES ("16", "Ibadan", "NGA", "3500000");
INSERT INTO "city" VALUES ("17", "Chennai", "IND", "7100000");
INSERT INTO "city" VALUES ("18", "Edinburgh", "GBR", "530000");
INSERT INTO "city" VALUES ("19", "Perth", "AUS", "2000000");
INSERT INTO "city" VALUES ("20", "Newcastle", "GBR", "300000");