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,
"DestAirport" TEXT,
PRIMARY KEY ("Airline", "FlightNo"),
FOREIGN KEY ("SourceAirport") REFERENCES "airports"("AirportCode"),
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", "OHare International Airport");
INSERT INTO "airports" VALUES ("Dallas", "DFW", "Dallas/Fort Worth International Airport");
INSERT INTO "airports" VALUES ("Atlanta", "ATL", "Hartsfield-Jackson Atlanta International Airport");
INSERT INTO "airports" VALUES ("Denver", "DEN", "Denver International Airport");
INSERT INTO "airports" VALUES ("San Francisco", "SFO", "San Francisco International Airport");
INSERT INTO "airports" VALUES ("Seattle", "SEA", "Seattle-Tacoma International Airport");
INSERT INTO "airports" VALUES ("Miami", "MIA", "Miami International Airport");
INSERT INTO "airports" VALUES ("Boston", "BOS", "Logan International Airport");
INSERT INTO "flights" VALUES ("1", "101", "JFK", "LAX");
INSERT INTO "flights" VALUES ("1", "102", "LAX", "JFK");
INSERT INTO "flights" VALUES ("2", "201", "ORD", "DFW");
INSERT INTO "flights" VALUES ("2", "202", "DFW", "ORD");
INSERT INTO "flights" VALUES ("3", "301", "ATL", "DEN");
INSERT INTO "flights" VALUES ("3", "302", "DEN", "ATL");
INSERT INTO "flights" VALUES ("1", "103", "JFK", "ORD");
INSERT INTO "flights" VALUES ("4", "401", "SFO", "SEA");
INSERT INTO "flights" VALUES ("4", "402", "SEA", "SFO");
INSERT INTO "flights" VALUES ("5", "501", "MIA", "BOS");
INSERT INTO "flights" VALUES ("5", "502", "BOS", "MIA");
INSERT INTO "flights" VALUES ("1", "104", "JFK", "DFW");
INSERT INTO "flights" VALUES ("2", "203", "ORD", "LAX");
INSERT INTO "flights" VALUES ("3", "303", "ATL", "JFK");
INSERT INTO "flights" VALUES ("1", "105", "JFK", "SFO");
INSERT INTO "flights" VALUES ("1", "106", "JFK", "SEA");
INSERT INTO "flights" VALUES ("2", "204", "ORD", "ATL");
INSERT INTO "flights" VALUES ("3", "304", "ATL", "MIA");
INSERT INTO "flights" VALUES ("1", "107", "JFK", "MIA");
INSERT INTO "flights" VALUES ("1", "108", "JFK", "BOS");
INSERT INTO "flights" VALUES ("2", "205", "ORD", "BOS");
INSERT INTO "flights" VALUES ("3", "305", "ATL", "SFO");
INSERT INTO "flights" VALUES ("1", "109", "JFK", "DEN");
INSERT INTO "flights" VALUES ("2", "206", "ORD", "DEN");
INSERT INTO "flights" VALUES ("3", "306", "ATL", "SEA");
INSERT INTO "flights" VALUES ("1", "110", "JFK", "ATL");
INSERT INTO "flights" VALUES ("2", "207", "ORD", "SFO");
INSERT INTO "flights" VALUES ("3", "307", "ATL", "LAX");
INSERT INTO "flights" VALUES ("1", "111", "JFK", "ORD");
INSERT INTO "flights" VALUES ("2", "208", "ORD", "MIA");
INSERT INTO "flights" VALUES ("3", "308", "ATL", "BOS");
INSERT INTO "flights" VALUES ("1", "112", "JFK", "LAX");
INSERT INTO "flights" VALUES ("2", "209", "ORD", "SEA");
INSERT INTO "flights" VALUES ("3", "309", "ATL", "DFW");
INSERT INTO "flights" VALUES ("1", "113", "JFK", "DFW");
INSERT INTO "flights" VALUES ("2", "210", "ORD", "JFK");
INSERT INTO "flights" VALUES ("3", "310", "ATL", "ORD");
INSERT INTO "flights" VALUES ("1", "114", "JFK", "BOS");
INSERT INTO "flights" VALUES ("2", "211", "ORD", "DFW");
INSERT INTO "flights" VALUES ("3", "311", "ATL", "DEN");
INSERT INTO "flights" VALUES ("1", "115", "JFK", "MIA");
INSERT INTO "flights" VALUES ("2", "212", "ORD", "LAX");
INSERT INTO "flights" VALUES ("3", "312", "ATL", "SFO");
INSERT INTO "flights" VALUES ("1", "116", "JFK", "SEA");
INSERT INTO "flights" VALUES ("2", "213", "ORD", "ATL");
INSERT INTO "flights" VALUES ("3", "313", "ATL", "SEA");
INSERT INTO "flights" VALUES ("1", "117", "JFK", "SFO");
INSERT INTO "flights" VALUES ("2", "214", "ORD", "MIA");
INSERT INTO "flights" VALUES ("3", "314", "ATL", "BOS");
INSERT INTO "flights" VALUES ("1", "118", "JFK", "DEN");
INSERT INTO "flights" VALUES ("2", "215", "ORD", "BOS");
INSERT INTO "flights" VALUES ("3", "315", "ATL", "JFK");