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),
"Continent" TEXT,
"Population" INT,
PRIMARY KEY ("Code")
);

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





INSERT INTO "country" VALUES ("CHN", "China", "Asia", "1330000000");
INSERT INTO "country" VALUES ("JPN", "Japan", "Asia", "127000000");
INSERT INTO "country" VALUES ("KOR", "South Korea", "Asia", "51000000");
INSERT INTO "country" VALUES ("SGP", "Singapore", "Asia", "5700000");
INSERT INTO "country" VALUES ("MYS", "Malaysia", "Asia", "32000000");
INSERT INTO "country" VALUES ("IND", "India", "Asia", "1380000000");
INSERT INTO "country" VALUES ("USA", "United States", "North America", "331000000");
INSERT INTO "country" VALUES ("CAN", "Canada", "North America", "38000000");
INSERT INTO "country" VALUES ("AUS", "Australia", "Oceania", "25000000");
INSERT INTO "country" VALUES ("DEU", "Germany", "Europe", "83000000");
INSERT INTO "city" VALUES ("1", "Beijing", "CHN", "21540000");
INSERT INTO "city" VALUES ("2", "Shanghai", "CHN", "26320000");
INSERT INTO "city" VALUES ("3", "Tokyo", "JPN", "13960000");
INSERT INTO "city" VALUES ("4", "Seoul", "KOR", "9770000");
INSERT INTO "city" VALUES ("5", "Singapore", "SGP", "5700000");
INSERT INTO "city" VALUES ("6", "Kuala Lumpur", "MYS", "1760000");
INSERT INTO "city" VALUES ("7", "Mumbai", "IND", "20410000");
INSERT INTO "city" VALUES ("8", "New York", "USA", "8420000");
INSERT INTO "city" VALUES ("9", "Toronto", "CAN", "2930000");
INSERT INTO "city" VALUES ("10", "Sydney", "AUS", "5310000");
INSERT INTO "city" VALUES ("11", "Berlin", "DEU", "3770000");
INSERT INTO "city" VALUES ("12", "Guangzhou", "CHN", "15300000");
INSERT INTO "city" VALUES ("13", "Hong Kong", "CHN", "7500000");
INSERT INTO "city" VALUES ("14", "Taipei", "CHN", "2700000");
INSERT INTO "city" VALUES ("15", "Osaka", "JPN", "2700000");
INSERT INTO "countrylanguage" VALUES ("CHN", "Chinese", "T");
INSERT INTO "countrylanguage" VALUES ("CHN", "English", "F");
INSERT INTO "countrylanguage" VALUES ("JPN", "Japanese", "T");
INSERT INTO "countrylanguage" VALUES ("KOR", "Korean", "T");
INSERT INTO "countrylanguage" VALUES ("SGP", "English", "T");
INSERT INTO "countrylanguage" VALUES ("SGP", "Malay", "F");
INSERT INTO "countrylanguage" VALUES ("SGP", "Mandarin Chinese", "T");
INSERT INTO "countrylanguage" VALUES ("MYS", "Malay", "T");
INSERT INTO "countrylanguage" VALUES ("MYS", "English", "F");
INSERT INTO "countrylanguage" VALUES ("IND", "Hindi", "T");
INSERT INTO "countrylanguage" VALUES ("IND", "English", "T");
INSERT INTO "countrylanguage" VALUES ("USA", "English", "T");
INSERT INTO "countrylanguage" VALUES ("CAN", "English", "T");
INSERT INTO "countrylanguage" VALUES ("CAN", "French", "T");
INSERT INTO "countrylanguage" VALUES ("AUS", "English", "T");
INSERT INTO "countrylanguage" VALUES ("DEU", "German", "T");
INSERT INTO "countrylanguage" VALUES ("CHN", "Cantonese", "T");
INSERT INTO "countrylanguage" VALUES ("CHN", "Hokkien", "F");