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,
"SourceAirport" TEXT,
PRIMARY KEY ("Airline", "FlightNo"),
FOREIGN KEY ("SourceAirport") 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 ("Baltimore", "APG", "Aberdeen Proving Ground Airport");
INSERT INTO "airports" VALUES ("Chicago", "ORD", "O'Hare International 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 "airports" VALUES ("Seattle", "SEA", "Seattle-Tacoma International Airport");
INSERT INTO "airports" VALUES ("Boston", "BOS", "Logan International Airport");
INSERT INTO "flights" VALUES ("1", "100", "APG");
INSERT INTO "flights" VALUES ("1", "101", "APG");
INSERT INTO "flights" VALUES ("2", "200", "JFK");
INSERT INTO "flights" VALUES ("2", "201", "LAX");
INSERT INTO "flights" VALUES ("3", "300", "APG");
INSERT INTO "flights" VALUES ("3", "301", "ORD");
INSERT INTO "flights" VALUES ("4", "400", "DFW");
INSERT INTO "flights" VALUES ("4", "401", "APG");
INSERT INTO "flights" VALUES ("5", "500", "SFO");
INSERT INTO "flights" VALUES ("5", "501", "APG");
INSERT INTO "flights" VALUES ("6", "600", "MIA");
INSERT INTO "flights" VALUES ("6", "601", "SEA");
INSERT INTO "flights" VALUES ("7", "700", "BOS");
INSERT INTO "flights" VALUES ("7", "701", "APG");
INSERT INTO "flights" VALUES ("8", "800", "DEN");
INSERT INTO "flights" VALUES ("8", "801", "ORD");