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

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





INSERT INTO "airports" VALUES ("Aberdeen", "ABZ", "Aberdeen International Airport", "United Kingdom");
INSERT INTO "airports" VALUES ("Aberdeen", "ABD", "Aberdeen Regional Airport", "United States");
INSERT INTO "airports" VALUES ("Aberdeen", "ABR", "Aberdeen Regional Airport", "United States");
INSERT INTO "airports" VALUES ("London", "LHR", "Heathrow Airport", "United Kingdom");
INSERT INTO "airports" VALUES ("New York", "JFK", "John F. Kennedy International Airport", "United States");
INSERT INTO "airports" VALUES ("Paris", "CDG", "Charles de Gaulle Airport", "France");
INSERT INTO "airports" VALUES ("Aberdeen", "ABQ", "Aberdeen Municipal Airport", "United States");
INSERT INTO "airports" VALUES ("Aberdeen", "ABX", "Aberdeen Airport", "Australia");
INSERT INTO "flights" VALUES ("1", "100", "ABZ");
INSERT INTO "flights" VALUES ("1", "101", "ABD");
INSERT INTO "flights" VALUES ("2", "200", "LHR");
INSERT INTO "flights" VALUES ("2", "201", "ABR");
INSERT INTO "flights" VALUES ("3", "300", "JFK");
INSERT INTO "flights" VALUES ("3", "301", "ABQ");
INSERT INTO "flights" VALUES ("4", "400", "ABX");
INSERT INTO "flights" VALUES ("4", "401", "CDG");