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 "airports" (
"City" TEXT,
"AirportCode" TEXT UNIQUE,
"AirportName" TEXT,
"Country" TEXT,
PRIMARY KEY ("AirportCode")
);

CREATE TABLE "flights" (
"Airline" INT,
"FlightNo" INT,
"SourceAirport" TEXT,
"DestAirport" TEXT,
PRIMARY KEY ("Airline", "FlightNo"),
FOREIGN KEY ("SourceAirport") REFERENCES "airports"("AirportCode"),
FOREIGN KEY ("DestAirport") REFERENCES "airports"("AirportCode")
);





INSERT INTO "airports" VALUES ("London", "LHR", "Heathrow Airport", "UK");
INSERT INTO "airports" VALUES ("New York", "JFK", "John F. Kennedy International Airport", "USA");
INSERT INTO "airports" VALUES ("Paris", "CDG", "Charles de Gaulle Airport", "France");
INSERT INTO "airports" VALUES ("Tokyo", "NRT", "Narita International Airport", "Japan");
INSERT INTO "airports" VALUES ("Dubai", "DXB", "Dubai International Airport", "UAE");
INSERT INTO "airports" VALUES ("Frankfurt", "FRA", "Frankfurt Airport", "Germany");
INSERT INTO "airports" VALUES ("Singapore", "SIN", "Changi Airport", "Singapore");
INSERT INTO "airports" VALUES ("Sydney", "SYD", "Sydney Airport", "Australia");
INSERT INTO "airports" VALUES ("Beijing", "PEK", "Beijing Capital International Airport", "China");
INSERT INTO "airports" VALUES ("Los Angeles", "LAX", "Los Angeles International Airport", "USA");
INSERT INTO "flights" VALUES ("1", "101", "LHR", "JFK");
INSERT INTO "flights" VALUES ("1", "102", "JFK", "LHR");
INSERT INTO "flights" VALUES ("2", "201", "CDG", "DXB");
INSERT INTO "flights" VALUES ("2", "202", "DXB", "CDG");
INSERT INTO "flights" VALUES ("3", "301", "NRT", "SIN");
INSERT INTO "flights" VALUES ("3", "302", "SIN", "NRT");
INSERT INTO "flights" VALUES ("4", "401", "LHR", "DXB");
INSERT INTO "flights" VALUES ("4", "402", "DXB", "LHR");
INSERT INTO "flights" VALUES ("5", "501", "JFK", "LAX");
INSERT INTO "flights" VALUES ("5", "502", "LAX", "JFK");
INSERT INTO "flights" VALUES ("6", "601", "FRA", "LHR");
INSERT INTO "flights" VALUES ("6", "602", "LHR", "FRA");
INSERT INTO "flights" VALUES ("7", "701", "PEK", "NRT");
INSERT INTO "flights" VALUES ("7", "702", "NRT", "PEK");
INSERT INTO "flights" VALUES ("8", "801", "SYD", "SIN");
INSERT INTO "flights" VALUES ("8", "802", "SIN", "SYD");
INSERT INTO "flights" VALUES ("9", "901", "LHR", "LAX");
INSERT INTO "flights" VALUES ("9", "902", "LAX", "LHR");
INSERT INTO "flights" VALUES ("10", "1001", "JFK", "DXB");
INSERT INTO "flights" VALUES ("10", "1002", "DXB", "JFK");
INSERT INTO "flights" VALUES ("11", "1101", "LHR", "CDG");
INSERT INTO "flights" VALUES ("11", "1102", "CDG", "LHR");
INSERT INTO "flights" VALUES ("12", "1201", "LHR", "NRT");
INSERT INTO "flights" VALUES ("12", "1202", "NRT", "LHR");
INSERT INTO "flights" VALUES ("13", "1301", "DXB", "SIN");
INSERT INTO "flights" VALUES ("13", "1302", "SIN", "DXB");
INSERT INTO "flights" VALUES ("14", "1401", "JFK", "CDG");
INSERT INTO "flights" VALUES ("14", "1402", "CDG", "JFK");
INSERT INTO "flights" VALUES ("15", "1501", "LHR", "PEK");
INSERT INTO "flights" VALUES ("15", "1502", "PEK", "LHR");