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" (
"AirportCode" TEXT,
"AirportName" 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 ("APG", "Phillips Army Airfield");
INSERT INTO "airports" VALUES ("BWI", "Baltimore/Washington International Thurgood Marshall Airport");
INSERT INTO "airports" VALUES ("DCA", "Ronald Reagan Washington National Airport");
INSERT INTO "airports" VALUES ("IAD", "Washington Dulles International Airport");
INSERT INTO "airports" VALUES ("JFK", "John F. Kennedy International Airport");
INSERT INTO "airports" VALUES ("LAX", "Los Angeles International Airport");
INSERT INTO "airports" VALUES ("ORD", "OHare International Airport");
INSERT INTO "airports" VALUES ("DFW", "Dallas/Fort Worth International Airport");
INSERT INTO "airports" VALUES ("ATL", "Hartsfield-Jackson Atlanta International Airport");
INSERT INTO "airports" VALUES ("DEN", "Denver International Airport");
INSERT INTO "flights" VALUES ("101", "1", "APG", "BWI");
INSERT INTO "flights" VALUES ("101", "2", "APG", "DCA");
INSERT INTO "flights" VALUES ("102", "3", "BWI", "APG");
INSERT INTO "flights" VALUES ("103", "4", "APG", "JFK");
INSERT INTO "flights" VALUES ("104", "5", "DCA", "LAX");
INSERT INTO "flights" VALUES ("105", "6", "APG", "ORD");
INSERT INTO "flights" VALUES ("106", "7", "JFK", "APG");
INSERT INTO "flights" VALUES ("107", "8", "LAX", "DFW");
INSERT INTO "flights" VALUES ("108", "9", "ORD", "ATL");
INSERT INTO "flights" VALUES ("109", "10", "APG", "DEN");
INSERT INTO "flights" VALUES ("110", "11", "DEN", "APG");
INSERT INTO "flights" VALUES ("111", "12", "APG", "BWI");
INSERT INTO "flights" VALUES ("112", "13", "APG", "DCA");
INSERT INTO "flights" VALUES ("113", "14", "BWI", "JFK");
INSERT INTO "flights" VALUES ("114", "15", "JFK", "LAX");