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

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





INSERT INTO "airports" VALUES ("New York", "JFK", "John F. Kennedy International Airport");
INSERT INTO "airports" VALUES ("Los Angeles", "LAX", "Los Angeles International Airport");
INSERT INTO "airports" VALUES ("Chicago", "ORD", "O'Hare International Airport");
INSERT INTO "airports" VALUES ("Baltimore", "APG", "Aberdeen Proving Ground Airport");
INSERT INTO "airports" VALUES ("Dallas", "DFW", "Dallas/Fort Worth International Airport");
INSERT INTO "airports" VALUES ("San Francisco", "SFO", "San Francisco International Airport");
INSERT INTO "airports" VALUES ("Miami", "MIA", "Miami International Airport");
INSERT INTO "airports" VALUES ("Denver", "DEN", "Denver International Airport");
INSERT INTO "flights" VALUES ("1", "100", "JFK");
INSERT INTO "flights" VALUES ("1", "101", "APG");
INSERT INTO "flights" VALUES ("2", "200", "LAX");
INSERT INTO "flights" VALUES ("2", "201", "APG");
INSERT INTO "flights" VALUES ("3", "300", "ORD");
INSERT INTO "flights" VALUES ("3", "301", "APG");
INSERT INTO "flights" VALUES ("4", "400", "DFW");
INSERT INTO "flights" VALUES ("4", "401", "SFO");
INSERT INTO "flights" VALUES ("5", "500", "APG");
INSERT INTO "flights" VALUES ("5", "501", "MIA");
INSERT INTO "flights" VALUES ("6", "600", "DEN");
INSERT INTO "flights" VALUES ("6", "601", "APG");
INSERT INTO "flights" VALUES ("7", "700", "JFK");
INSERT INTO "flights" VALUES ("7", "701", "ORD");
INSERT INTO "flights" VALUES ("8", "800", "LAX");
INSERT INTO "flights" VALUES ("8", "801", "DFW");